Webpack common code vendor shows that the es6 syntax has not been compiled, but other package files have been compiled

problem description

webpack common code vendor shows that the es6 syntax has not been compiled, but other package files have been compiled

related codes

/ / Please paste the code text below (do not replace the code with pictures)

{
            test: /\.jsx?$/,
            exclude: /(node_modules|bower_components)/,
            loader: "babel-loader",
            query: {
                "plugins": [["transform-decorators-legacy"], ["transform-runtime"],
            ],
                "presets" : [
                    [ "env", {
                        "modules": false
                    }],
                    "es2015",
                    "react",
                    "stage-0"
                 ]
            }
        }
 // 
    new webpack.optimize.CommonsChunkPlugin({ 
        name: "vendor", 
        filename: "js/[name].[hash:8].js"
     }),          

Picture

is the content of this and is not compiled

Apr.05,2021

some dependencies may have been dropped by your exclude, so check it out for yourself without babel-loader processing.


the new syntax will be compiled, and the new method will not change after compilation. The support of the new method depends on polyfill
and yours is obviously dropped by exclude


the difference is that there is node_modules code in vendor. Others are contained by the business code.

so check out how the js section of your webpack handles it.


solved because my vendor is packaged and the third-party components are all in the dependencies of package.json, and the code is in node_modules, and then my configuration excludes the node_modules of exclude, so the things in it are not compiled.

Menu