Reputation: 25835
I am using the es6-symbol NPM Package to polyfill Symbol for older browsers.
I don't want to import this module everywhere in my code, so I added a ProvidePlugin config to implicitly import it where needed.
new webpack.ProvidePlugin({
"Symbol": "es6-symbol",
}),
The problem is that my webpack build now detects the use of Symbol in my polyfill package:
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! es6-symbol */ "./node_modules/es6-symbol/index.js")))
So the polyfill package is detecting itself and failing to use the native Symbol in newer browsers. Is there any way to exclude my polyfill package from ProvidePlugin?
This question is similar to Excluding ProvidePlugin from an entry point but not identical.
Upvotes: 0
Views: 205
Reputation: 25835
I solved the issue by submitting a pull request that prefixed Symbol
with the global (global.Symbol
) so that webpack would ignore it.
I'd still love to find a more universal solution as not all open source owners are so responsive.
Upvotes: 1