Webpack ProvidePlugin actually has an undocumented function: you can configure it using an array instead of a string, and it will extract the given object path from the module export.
This allows you to use the official TypeScript tslib module, which exports all the necessary functions.
The following code works with webpack@2.2.1 :
new webpack.ProvidePlugin({ '__assign': ['tslib', '__assign'], '__extends': ['tslib', '__extends'], })
Make sure Webpack is using the ES6 tslib module version:
aliases: { 'tslib$': 'tslib/tslib.es6.js', }
And configure tsc / tsconfig.json not to use helper functions for each module:
{ "compilerOptions": { "noEmitHelpers": true, } }
Change My download request for updating the documentation has been combined, so you will find it on the official website, and now: https://webpack.js.org/guides/shimming/
Kevin f
source share