Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/webpack/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Node.js &引用;插件/预设文件不允许导出对象,只能导出功能;Babel/core和Babel loader的最新版本_Node.js_Webpack_Babeljs_Upgrade - Fatal编程技术网

Node.js &引用;插件/预设文件不允许导出对象,只能导出功能;Babel/core和Babel loader的最新版本

Node.js &引用;插件/预设文件不允许导出对象,只能导出功能;Babel/core和Babel loader的最新版本,node.js,webpack,babeljs,upgrade,Node.js,Webpack,Babeljs,Upgrade,因此,我安装了最新版本的Babel/core和Babal loader,因为我正在尝试升级到Webpack 4,但它说: Plugin/Preset files are not allowed to export objects, only functions. 当我在开发模式下运行Webpack时。我不能真的降级,因为那样Webpack4就不起作用了。以下是我的开发依赖项: devDependencies": { "@babel/cli": "^7.4.4", "@babel

因此,我安装了最新版本的Babel/core和Babal loader,因为我正在尝试升级到Webpack 4,但它说:

Plugin/Preset files are not allowed to export objects, only functions.
当我在开发模式下运行Webpack时。我不能真的降级,因为那样Webpack4就不起作用了。以下是我的开发依赖项:

devDependencies": {
    "@babel/cli": "^7.4.4",
    "@babel/core": "^7.4.4",
    "@babel/preset-env": "^7.4.4",
    "@babel/preset-es2015": "^7.0.0-beta.53",
    "acorn": "^6.1.1",
    "ajv": "^6.10.0",
    "autoprefixer": "6.7.2",
    "babel-eslint": "7.1.1",
    "babel-loader": "8.0.5",
    "babel-plugin-transform-es2015-arrow-functions": "^6.22.0",
    "babel-plugin-transform-runtime": "6.23.0",
    "babel-preset-env": "^1.7.0",
    "babel-preset-stage-2": "6.22.0",
    "babel-register": "6.22.0",
    "bootstrap": "4.3.1",
    "bootstrap-loader": "3.0.4",
    "chalk": "1.1.3",
    "compression-webpack-plugin": "2.0.0",
    "connect-history-api-fallback": "1.3.0",
    "copy-webpack-plugin": "5.0.3",
    "css-loader": "2.1.1",
    "eslint": "3.14.1",
    "eslint-config-standard": "6.2.1",
    "eslint-friendly-formatter": "2.0.7",
    "eslint-loader": "2.1.2",
    "eslint-plugin-html": "2.0.0",
    "eslint-plugin-promise": "3.4.0",
    "eslint-plugin-standard": "2.0.1",
    "eventsource-polyfill": "0.9.6",
    "exports-loader": "0.6.4",
    "express": "4.14.1",
    "extract-text-webpack-plugin": "3.0.2",
    "file-loader": "0.10.0",
    "friendly-errors-webpack-plugin": "1.7.0",
    "function-bind": "1.1.0",
    "html-webpack-plugin": "3.2.0",
    "http-proxy-middleware": "0.17.3",
    "imports-loader": "0.8.0",
    "mini-css-extract-plugin": "^0.6.0",
    "node-sass": "4.12.0",
    "opn": "4.0.2",
    "optimize-css-assets-webpack-plugin": "5.0.1",
    "ora": "1.1.0",
    "popper.js": "^1.15.0",
    "postcss-input-range": "github:whatknight/postcss-input-range#bugfix",
    "postcss-loader": "3.0.0",
    "resolve-url-loader": "2.0.2",
    "rimraf": "2.6.0",
    "sass-loader": "7.1.0",
    "semver": "6.0.0",
    "style-loader": "0.14.1",
    "url-loader": "0.5.8",
    "vue-loader": "15.7.0",
    "vue-style-loader": "2.0.0",
    "vue-template-compiler": "2.3.3",
    "webpack": "4.30.0",
    "webpack-bundle-analyzer": "3.3.2",
    "webpack-dev-middleware": "3.6.2",
    "webpack-hot-middleware": "2.24.4",
    "webpack-merge": "4.2.1"
  },
这是我的宝贝:

{
  "presets": ["stage-2", "@babel/preset-env"],
  "plugins": ["transform-runtime"],
  "comments": false
}
以下是导致问题的原因:

{
        test: /\.m?js$/,
        exclude: /(node_modules|bower_components)/,
        include: [resolve('src'), resolve('test'), resolve('node_modules/vue-awesome'), resolve('node_modules/vue-uploader')],
        use: {
          loader: 'babel-loader',
          options: {
            presets: ['stage-2', '@babel/preset-env']
          }
        }


      },

我该怎么办?

预设的
'stage-2'
是为巴别塔6准备的。既然你上的是巴别塔7,那就失败了。巴别塔7中的舞台预设被完全删除()。您应该安装您实际想要使用的特定建议插件