babel编译带有装饰器语法的代码报错
来源:3-4 store配置(2)

小王子抓猫咪
2017-12-17
我装了stage-1 也装了babel-plugin-transform-decorators-legacy , 还装了 babel-plugin-transform-decorators 插件。
同时也在babelrc文件中定义了plugins选项第一项就是legacy这个插件。
在presets中也加入了stage-1
但是编译的时候依然会报错,说@这个符号无法parser解析
由于我是在后缀JS的文件中写的REACT代码,并没有使用JSX后缀文件。
所以我很纳闷为什么我编译的时候会报错呢?哪位童鞋知道这个原因吗?
写回答
4回答
-
小王子抓猫咪
提问者
2017-12-17
{ "presets": [ //"stage-1", ["env", {"modules": false}], "react" ], "plugins": [ "transform-decorators-legacy", "transform-class-properties", "react-hot-loader/babel" ] }
00 -
小王子抓猫咪
提问者
2017-12-17
module.exports = { "env": { "browser": true, "commonjs": true, "es6": true, "node": true }, "extends": [ "eslint:recommended", "plugin:react/recommended", // "airbnb" ], "parser": "babel-eslint", "parserOptions": { "ecmaVersion": 6, "sourceType": "module" }, "rules": { "indent": [ "error", 2 ], "linebreak-style": [ "error", "windows" ], "quotes": [ "error", "double" ], "semi": [ "error", "always" ] } };
00 -
Jokcy
2017-12-17
请把你的babel和webpack配置文件截图一下
022017-12-18 -
人生导师_毛毛
2017-12-17
我也遇到了这个问题,同问
00
相似问题