babel / preset-modules

A Babel preset that targets modern browsers by fixing engine bugs (will be merged into preset-env eventually)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Not working correctly with webpack-bundle-analyzer

Makio64 opened this issue · comments

When I user the preset-modules, the bundle analyzer plugin doesnt show the gzip size from the bundle compile by babel.

Works correctly with @babel/preset-env.

I opened an issue also on the webpack-bundle-analyzer repo
#webpack-contrib/webpack-bundle-analyzer#440

The best way to solve this is to switch from @babel/preset-modules to @babel/preset-env with the new bugfixes:true option. It's the same set of plugins, but you get to control the browser configuration:

{
  "presets": [
-    ["@babel/preset-modules"]
+    ["@babel/preset-env", {
+      "targets": {
+        "esmodules": true
+      },
+      "bugfixes": true
+    }]
  ]
}