reactjs – React 0.14错误:模块构建失败:ReferenceError:[BABEL] … / node_modules / eslint-loader / index.js!/…/main.jsx:未知选项:base.stage

前端之家收集整理的这篇文章主要介绍了reactjs – React 0.14错误:模块构建失败:ReferenceError:[BABEL] … / node_modules / eslint-loader / index.js!/…/main.jsx:未知选项:base.stage前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
这是我的package.json:
"scripts": {
    "test": "echo \"Error: no test specified\n\" && exit 1","lint": "npm run lint-js && npm run lint-css","lint-js": "echo \"\\033[33mLinting JS\\033[0m\n\" && eslint . --ext .js --ext .jsx","lint-css": "echo \"\\033[33mLinting CSS\\033[0m\n\" && csslint app/style --quiet","start": "echo \"\\033[33mStarting dev server at localhost:8080\\033[0m\n\" && TARGET=dev webpack-dev-server --devtool eval-source --progress --colors --hot --inline --history-api-fallback","compile": "echo \"\\033[33mBuilding for production\\033[0m\n\" && TARGET=build webpack -p","build": "npm run lint-js && npm run lint-css && npm run compile"
  },"private": true,"dependencies": {
    "alt": "^0.17.8","babel-core": "^6.1.2","babel-loader": "^6.1.0","babelify": "^7.2.0","css-loader": "^0.22.0","csslint": "^0.10.0","csslint-loader": "^0.2.1","eslint": "^1.9.0","eslint-plugin-react": "^3.8.0","file-loader": "^0.8.4","flowcheck": "^0.2.7","flowcheck-loader": "^1.0.0","gsap": "^1.18.0","html-webpack-plugin": "^1.6.2","jquery-browserify": "^1.8.1","node-libs-browser": "^0.5.3","radium": "^0.14.3","react": "^0.14.2","react-bootstrap": "^0.27.3","react-bootstrap-modal": "^2.0.0","react-dom": "^0.14.2","react-hot-loader": "^1.3.0","react-odometer": "0.0.1","react-slick": "^0.9.1","react-swf": "^0.13.0","style-loader": "^0.13.0","superagent": "^1.4.0","url-loader": "^0.5.6","video.js": "^5.0.2","webpack": "^1.12.3","webpack-dev-server": "^1.12.1","webpack-merge": "^0.2.0"
  }
}

这是完整的错误消息,我读到这个错误可以使用babelify解决,所以我添加它,虽然我不需要它.

./app/中的错误

main.jsx
Module build Failed: ReferenceError: [BABEL] /Dev/Fanatico/node_modules/eslint-loader/index.js!/Dev/Fanatico/app/main.jsx: Unknown option: base.stage
    at Logger.error (/Dev/Fanatico/node_modules/babel-core/lib/transformation/file/logger.js:43:11)
    at OptionManager.mergeOptions (/Dev/Fanatico/node_modules/babel-core/lib/transformation/file/options/option-manager.js:245:18)
    at OptionManager.init (/Dev/Fanatico/node_modules/babel-core/lib/transformation/file/options/option-manager.js:396:10)
    at File.initOptions (/Dev/Fanatico/node_modules/babel-core/lib/transformation/file/index.js:191:75)
    at new File (/Dev/Fanatico/node_modules/babel-core/lib/transformation/file/index.js:122:22)
    at Pipeline.transform (/Dev/Fanatico/node_modules/babel-core/lib/transformation/pipeline.js:42:16)
    at transpile (/Dev/Fanatico/node_modules/babel-loader/index.js:14:22)
    at Object.module.exports (/Dev/Fanatico/node_modules/babel-loader/index.js:83:14)
 @ multi main

这一切都是在我想升级到React 0.14时开始的,最后逐个安装所有的软件包.

您将需要安装:

巴贝尔核心
巴贝尔装载机
babel-preset-es2015
babel预设反应
babel-preset-stage-0

你的package.json的依赖是:

{
  "name": "react-transform-example","devDependencies": {
    "babel-core": "^6.0.20","babel-loader": "^6.0.1","babel-preset-es2015": "^6.0.15","babel-preset-react": "^6.0.15","babel-preset-stage-0": "^6.0.15","express": "^4.13.3","webpack": "^1.9.6"
  },"dependencies": {
    "react": "^0.14.0","react-dom": "^0.14.0"    
  }
}

和你的.babelrc文件

{
  "presets": ["es2015","stage-0","react"]
}

setting-up-babel-6的更多信息

猜你在找的React相关文章