Zhell
Zhell

Reputation: 95

How to turn off webpack bundling changing class names for just 1 class?

I have a basic class in my code:

class MyClass1 {}

and I use webpack to compile the full code. After compilation all class names are changed by webpack to something like this:

D_Documents_GitHub_Project_node_modules_babel_preset_react_app_node_modules_babel_runtime_helpers_esm_classCallCheck__WEBPACK_IMPORTED_MODULE_0__["default"])(this, MyClass1);

For some reason I need a few classes in my entire code to keep their original name and not get renamed. What is the best way of achieving this ?

I know I can import them externally and use webpack-externals to prevent bundling, but I was wondering if there is a way to do it with classes defined in the code itself, with maybe something like a decorator

Upvotes: 1

Views: 735

Answers (1)

Madhu Nair
Madhu Nair

Reputation: 436

According to the doc

exclude: {
  test: [
    ..,
    ..,
  ],
  exclude: [
    'src/configs/configs/some.extention'
  ]
}

Upvotes: 2

Related Questions