Tag Archives: “exports is not defined”

For Vue, an error is reported in “exports is not defined” in webpack

Error message after Vue project NPM run dev: prompt  “ exports is not defined”。

 

This problem is caused by the problem of the configuration file. Babelrc of balbel:

{
  "presets": [
    ["env", { "modules": false }],
    "stage-2"
  ],
  "plugins": ["transform-runtime"],
  "comments": false,
  "env": {
    "test": {
      "presets": ["env", "stage-2"],
      "plugins": [ "istanbul" ]
    }
  }
}

Remove  { ” Modules “: false} where {” modules “: false} prevents Babel from module conversion. See the description of modules configuration for details. Therefore, change modules to the default setting or delete the configuration