Skip to content

Instantly share code, notes, and snippets.

@fstanis
Created October 15, 2017 22:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fstanis/450776f48682e6ff85b7c7ba366a5d1e to your computer and use it in GitHub Desktop.
Save fstanis/450776f48682e6ff85b7c7ba366a5d1e to your computer and use it in GitHub Desktop.
Webpack ProvidePlugin polyfill guard bug
console.log(mdl);
if (typeof mdl === 'undefined') {
module.exports = { name: 'test' };
} else {
module.exports = mdl;
}
const webpack = require('webpack');
module.exports = {
output: {
filename: 'out.js',
},
entry: './app.js',
plugins: [
new webpack.ProvidePlugin({
// Changing "mdl:" to anything else will make it work
mdl: './module.js'
})
]
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment