Open ayxos opened 4 years ago
I have PR that you can test. https://github.com/alexpalombaro/modernizr-webpack-plugin/pull/43
hi @soda0289 I have tried your PR but no luck, maybe my config is no longer valid, but all I got is the modernizrrc.json as response and not the object
Here is my plugin config:
new ModernizrWebpackPlugin({
'noChunk': true,
'filename': 'modernizr',
'htmlWebpackPlugin': true,
'minify': {
compress: {
screw_ie8: false
},
mangler: {
screw_ie8: false
},
output: {
screw_ie8: false
}
},
'options': [
'addTest'
],
'feature-detects': [
'test/es5/specification',
'test/es6/arrow',
'test/es6/collections',
'test/es6/generators',
'test/es6/math',
'test/es6/number',
'test/es6/object',
'test/es6/promises',
'test/es6/string'
]
})
My configuration adds Modernizer as a global using html-webpack-plugin.
Can you add a console.log() or debugger to the Modernizer build callback, found here: https://github.com/alexpalombaro/modernizr-webpack-plugin/blob/37479ac5a7c6ba3316bb6a841e9d0c041f1badce/index.js#L108
You mentioned you got modernizrrc.json was that returned by the modernizer build and included with html-webpack-plugin or just included in the webpack output as a file?
I've been searching/debugging for a few hours today so I'm hoping this helps you or someone else. All Webpack loaders and plugins that handle Modernizr builds don't seem to be updated for Webpack 5 or are no longer maintained at all anymore.
There's a guide within the official Webpack documentation on how to set this up with val-loader
but it requires quite a big custom implementation. Since I needed this in multiple projects I have abstracted this away into (shameless plug) val-loader-modernizr
, feel free to use it if you're using Webpack 5 ✌🏼
with the new version
compiler.plugin
is no longer available (usehooks
instead) So this plugin does not work.Can we update it?