ant-tool / atool-build

:hammer: Build tool based on webpack.
391 stars 75 forks source link

ERROR in index.js from UglifyJs #276

Closed phnessu4 closed 7 years ago

phnessu4 commented 7 years ago

ERROR in index.js from UglifyJs SyntaxError: Unexpected token name «i», expected punc «;» [./~/dot-prop/index.js:9,0]

引入dot-prop的时候报错了。

本地的 .babelrc { "plugins": [ "transform-strict-mode", "transform-es2015-modules-commonjs", "transform-es2015-spread", "transform-es2015-destructuring", "transform-es2015-parameters", "syntax-async-functions", "transform-async-to-generator", "syntax-export-extensions", ] }

soda-x commented 7 years ago

不能使用本地的 .babelrc 吧,需要建立在修改 webpackConfig.babel 的基础上才行。

目前是这样的。

phnessu4 commented 7 years ago

@pigcan 搞定了,atool-build默认是5+react+stage0。 我项目引用的dot-prop用6的标准写的,所以报错了。

不能使用本地的 .babelrc 这个,不知道文档上有没有,还是写的太隐晦了,挺坑的,最好有个明确点的文档。还有默认的presets,虽然源码可以直接看,但最好文档上也标注下。

配置文件倒是好了,但是项目不适合用了,老版本的代码全是es5,强升代价太大,只能把第三方库fork出来自己降级了。

贴个presets工具地址,方便后来的自己转换和检查。 presets工具地址

soda-x commented 7 years ago

你可以在 webpack.config.js 中修改 webpackConfig.babel.preset 的内容

phnessu4 commented 7 years ago

嗯,已经改了。@pigcan

webpackConfig.babel.presets = [ require.resolve('babel-preset-es2016'), require.resolve('babel-preset-react'), require.resolve('babel-preset-stage-0'), ]