webpack 编译报错 Couldn't find preset "env"
ERROR in ./product/entry/login.jsModule build failed: Error: Couldn't find preset "env" relative to directory "D:\\work\\Vue\\cdm-builder\\cdm\\src\\web" at D:\work\Vue\cdm-builder\cdm\src\web\
·
ERROR in ./product/entry/login.js
Module build failed: Error: Couldn't find preset "env" relative to directory "D:\\work\\Vue\\cdm-builder\\cdm\\src\\web"
at D:\work\Vue\cdm-builder\cdm\src\web\node_modules\babel-core\lib\transformation\file\options\option-manager.js:293:19
at Array.map (native)
at OptionManager.resolvePresets (D:\work\Vue\cdm-builder\cdm\src\web\node_modules\babel-core\lib\transformation\file\options\option-manager.js:275:20)
at OptionManager.mergePresets (D:\work\Vue\cdm-builder\cdm\src\web\node_modules\babel-core\lib\transformation\file\options\option-manager.js:264:10)
at OptionManager.mergeOptions (D:\work\Vue\cdm-builder\cdm\src\web\node_modules\babel-core\lib\transformation\file\options\option-manager.js:249:14)
at OptionManager.init (D:\work\Vue\cdm-builder\cdm\src\web\node_modules\babel-core\lib\transformation\file\options\option-manager.js:368:12)
at File.initOptions (D:\work\Vue\cdm-builder\cdm\src\web\node_modules\babel-core\lib\transformation\file\index.js:212:65)
at new File (D:\work\Vue\cdm-builder\cdm\src\web\node_modules\babel-core\lib\transformation\file\index.js:135:24)
at Pipeline.transform (D:\work\Vue\cdm-builder\cdm\src\web\node_modules\babel-core\lib\transformation\pipeline.js:46:16)
at transpile (D:\work\Vue\cdm-builder\cdm\src\web\node_modules\babel-loader\lib\index.js:46:20)
at Object.module.exports (D:\work\Vue\cdm-builder\cdm\src\web\node_modules\babel-loader\lib\index.js:163:20)
@ multi main
Module build failed: Error: Couldn't find preset "env" relative to directory "D:\\work\\Vue\\cdm-builder\\cdm\\src\\web"
at D:\work\Vue\cdm-builder\cdm\src\web\node_modules\babel-core\lib\transformation\file\options\option-manager.js:293:19
at Array.map (native)
at OptionManager.resolvePresets (D:\work\Vue\cdm-builder\cdm\src\web\node_modules\babel-core\lib\transformation\file\options\option-manager.js:275:20)
at OptionManager.mergePresets (D:\work\Vue\cdm-builder\cdm\src\web\node_modules\babel-core\lib\transformation\file\options\option-manager.js:264:10)
at OptionManager.mergeOptions (D:\work\Vue\cdm-builder\cdm\src\web\node_modules\babel-core\lib\transformation\file\options\option-manager.js:249:14)
at OptionManager.init (D:\work\Vue\cdm-builder\cdm\src\web\node_modules\babel-core\lib\transformation\file\options\option-manager.js:368:12)
at File.initOptions (D:\work\Vue\cdm-builder\cdm\src\web\node_modules\babel-core\lib\transformation\file\index.js:212:65)
at new File (D:\work\Vue\cdm-builder\cdm\src\web\node_modules\babel-core\lib\transformation\file\index.js:135:24)
at Pipeline.transform (D:\work\Vue\cdm-builder\cdm\src\web\node_modules\babel-core\lib\transformation\pipeline.js:46:16)
at transpile (D:\work\Vue\cdm-builder\cdm\src\web\node_modules\babel-loader\lib\index.js:46:20)
at Object.module.exports (D:\work\Vue\cdm-builder\cdm\src\web\node_modules\babel-loader\lib\index.js:163:20)
@ multi main
错误原因:
在 .babelrc 文件中设置了env 选项,这需要 babel-preset-env
npm install babel-preset-env --save-dev 依赖引入
更多推荐
已为社区贡献3条内容
所有评论(0)