模块构建失败:ReferenceError:[BABEL]未知选项:base.stage

时间:2016-02-05 08:48:32

标签: javascript reactjs babeljs

我使用ncu升级了react / webpack应用程序,并将babelify更新为7.2.0(因此babel更新为6.0.0)。现在我收到以下错误:

ERROR in ./app/main.js Module build failed: ReferenceError: [BABEL] /home/ben/simple-webpack-react-starter/app/main.js: Unknown option: base.stage

我查看了一堆具有相同或类似错误的堆栈溢出帖子并完成了所有建议。我被卡住了!请帮忙。以下是我认为的相关文件:

我的package.json文件:

{
  "name": "MODA",
  "version": "1.0.0",
  "description": "Online Annotations",
  "main": "server/index.js",
  "scripts": {
    "dev-server": "nodemon server/index.js --watch server",
    "dev-web": "webpack-dev-server --config ./webpack-dev.config.js --hot --progress --colors --content-base build",
    "dev": "nodemon server/index.js --watch server & webpack-dev-server --config ./webpack-dev.config.js --hot --progress --colors --content-base build",
    "build": "rm build/*; webpack --config ./webpack-prod.config.js --progress --colors",
    "start": "node server/index.js",
    "test": "karma start",
    "testing": "karma start --single-run=false"
  },
  "license": "MIT",
  "dependencies": {
    "compression": "^1.5.0",
    "cors": "^2.7.1",
    "express": "^4.13.3",
    "body-parser": "*",
    "ejs": "*",
    "aws-sdk": "*"
  },
  "engines": {
    "node": "5.0.0",
    "npm": "2.14.9"
  },
  "devDependencies": {
    "autoprefixer-loader": "^3.2.0",
    "babel-core": "^6.2.1",
    "babel-loader": "^6.2.0",
    "babel-preset-es2015": "^6.1.18",
    "babel-preset-react": "^6.3.13",
    "babel-preset-stage-0": "^6.0.15",
    "babelify": "^7.2.0",
    "bootstrap": "^3.3.5",
    "css-loader": "^0.23.1",
    "expect": "^1.6.0",
    "file-loader": "^0.8.4",
    "html-webpack-plugin": "^2.8.1",
    "image-webpack-loader": "^1.6.1",
    "jquery": "^2.1.4",
    "json-fs": "^1.1.1",
    "karma": "^0.13.19",
    "karma-chrome-launcher": "^0.2.2",
    "karma-cli": "0.1.2",
    "karma-mocha": "^0.2.1",
    "karma-sinon": "^1.0.4",
    "karma-sourcemap-loader": "^0.3.5",
    "karma-webpack": "^1.5.1",
    "mocha": "^2.2.5",
    "node-libs-browser": "^1.0.0",
    "node-sass": "^3.2.0",
    "nodemon": "^1.3.7",
    "react": "^0.14.7",
    "react-dom": "^0.14.7",
    "react-draggable": "^1.1.3",
    "react-hot-loader": "^1.2.7",
    "react-resizable-box": "^0.1.7",
    "sass-loader": "^3.1.2",
    "sinon": "^1.15.3",
    "style-loader": "^0.13.0",
    "webpack": "^1.9.11",
    "webpack-dev-server": "^1.9.0"
  }
}

我的webpack-common.config的相关部分

{
    test: /\.jsx?$/,
    exclude: /(node_modules | bower_components)/,
    loader: "babel",
    query: {
        presets:['es2015','stage-0', "react"]
    },
},

1 个答案:

答案 0 :(得分:2)

我遇到了这个问题,我通过删除配置文件中的查询来修复它,而是在项目根目录下创建.babelrc文件,如下所示:

XDocument doc = XDocument.Parse(theXML);
XNamespace ns = "http://www.portalfiscal.inf.br/nfe";
var cProdNodes = doc.Descendants().Elements().Where (d => d.Name == ns + "cProd");
List<string> cProdValues = cProdNodes.Select (pn => pn.Value).ToList();