Open Pszz opened 6 years ago
查了下,原来是 ["es2015", { "modules": false }] 配置 “modules”: false 之后无法编译import 语法 有何解决之法?不用对本组件有何影响
{ "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"] } } }
我的.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