babel-minify-webpack-plugin icon indicating copy to clipboard operation
babel-minify-webpack-plugin copied to clipboard

Babel 7 Support

Open drwpow opened this issue 7 years ago • 13 comments

This plugin still depends on babel-core 6.23. Any possibility of updating to @babel/core instead?

drwpow avatar Sep 04 '18 17:09 drwpow

@dangodev please wait new release (will be in near future)

alexander-akait avatar Sep 04 '18 17:09 alexander-akait

@evilebottnawi any news?

indeyets avatar Nov 02 '18 17:11 indeyets

option babel and minifyPreset help me

new MinifyPlugin({ builtIns: false }, {
    babel: require('@babel/core'),
    minifyPreset: require('babel-preset-minify')
})

wangqs1990 avatar Dec 16 '18 15:12 wangqs1990

Does this plugin still not support Babel 7?

hershmire avatar Jan 28 '19 21:01 hershmire

@hershmire wangqs1990‘s solution works well.

ztyzbb avatar Jan 29 '19 03:01 ztyzbb

I'm not so sure this is stable with babel 7.2.2 and webpack 4.29... Using the above workaround I get:

    ERROR in Cannot read property 'isPure' of null

If I add to the plugin options removeUndefined: false it works around that, but then something else fails:

    ERROR in Cannot read property 'getBinding' of null

bvibber avatar Feb 04 '19 16:02 bvibber

Sorry, don't have time on this right now, my todo list is very big :disappointed:

alexander-akait avatar Feb 04 '19 16:02 alexander-akait

I'm seeing:

ERROR in Couldn't find intersection

ERROR in Couldn't find intersection

ERROR in Couldn't find intersection

ERROR in Couldn't find intersection

ERROR in Couldn't find intersection

ERROR in Couldn't find intersection

ERROR in Couldn't find intersection

ERROR in don't know how to turn this value into a node

config:

new MinifyPlugin({}, {
  babel: require("@babel/core"),
  minifyPreset: require("babel-preset-minify")
})

I've tried a variation, copying @wangqs1990 suggestion, same result:

new MinifyPlugin({
  builtIns: false,
  mangle: { topLevel: true }
}, {
  babel: require("@babel/core"),
  minifyPreset: require("babel-preset-minify")
})

gknapp avatar Mar 18 '19 12:03 gknapp

Hi @gknapp,

I am experiencing the exact same isssues as you with Webpack 4.29.6 and Babel 7. Have you found any fixes or any ways to bypass those errors messages ?

jsauca avatar Apr 01 '19 12:04 jsauca

@jsauca I aborted switching to this plugin for minification and returned to uglifyjs-webpack-plugin.

I read this plugin produced better minified code but couldn't get it to work. Chrome inspector's coverage reports drove me to try and seek smaller build sizes - it appears to be somewhat common for reactjs based web app to only have ~50% code coverage / usage.

I've read including node_modules in production build configs could eliminate a lot of dead / unused code.

gknapp avatar Apr 16 '19 14:04 gknapp

Looks like I have kind of similar issue as @gknapp has, breaks on adding @babel/core as custom 'babel' field value.

ERROR in Cannot read property 'isPure' of null ERROR in Cannot read property 'isProgram' of null

"webpack": "^4.29.6" , "@babel/core": "^7.4.3"

liringlas avatar Apr 21 '19 11:04 liringlas

I tried this and other various tweaks to try and eliminate any unused code. I already had webpack in production mode, I found no difference in bundle size by including node_modules.

I've read including node_modules in production build configs could eliminate a lot of dead / unused code.

gknapp avatar Apr 23 '19 16:04 gknapp

I would like to re-enable this plugin, but whenever I do, and try to build, the build process just gets stuck in limbo without any output. Is this issue being worked on?

Haraldson avatar Jul 30 '19 18:07 Haraldson