mint-ui / docs

documentation for mint-ui.
http://mint-ui.github.io/docs
MIT License
213 stars 138 forks source link

babelrc 更改后无法运行项目 #65

Open Pszz opened 6 years ago

Pszz commented 6 years ago

我的.babelrc 结构原先是 { "presets": ["es2015", "stage-2"], "plugins": ["transform-runtime"], "comments": false } 按照官网改为: { "presets": [ ["es2015", { "modules": false }] ], "plugins": [["component", [ { "libraryName": "mint-ui", "style": true } ]]] } 运行 npm run dev 之后 提示 import 无法识别 Uncaught SyntaxError: Unexpected token import

Pszz commented 6 years ago

查了下,原来是 ["es2015", { "modules": false }] 配置 “modules”: false 之后无法编译import 语法 有何解决之法?不用对本组件有何影响

hushenao commented 6 years ago

{ "presets": [ ["env", { "modules": false }], "stage-2" ], "plugins": ["transform-runtime", ["component", [ { "libraryName": "mint-ui", "style": true } ] ] ], "env": { "test": { "presets": ["env", "stage-2"], "plugins": ["transform-es2015-modules-commonjs", "dynamic-import-node"] } } }