If you refer to popper.js webpack and do not configure exclude:'/ popper.js', you will report an error if you call PopperJSj.

when referencing popper.js, if packaging does not rule out popper.js, calling new PopperJS, an error will be reported

    let PopperJS = require("./popper");
    let popper = new PopperJS(); // PopperJS is not a constructor

webpack.base.conf.js:

              {
                test: /\.js(x)*$/,
                loader: "babel-loader",
                include: [resolve("src")]
              },

webpack.base.conf.js, it is normal if popper.js is excluded.

      {
        test: /\.js(x)*$/,
        loader: "babel-loader",
        include: [resolve("src")],
        exclude: [resolve("src/utils/popper.js")]
      },

excuse me, why is this happening?


does anyone know why


print out the two cases respectively

Menu