zdj 2019-09-08
代码库迁移时遇到的问题
1.不识别es6语法
扩展运算符...报错

...是es6的对象扩容运算符,目前babel暂不支持,需要引入新的包来解决,要安装一个babel插件翻译对象展开运算符语法。
解决方法:
npm install babel-plugin-transform-object-rest-spread
根目录下创建 .babelrc文件
.babelrc文件中写:
{
    "presets": [
        ["es2015", { "modules": false }]
    ],
    "plugins": ["transform-object-rest-spread"] //不能解析es6语法关键解决
}2.报错
ModuleBuildError: Module build failed: Error: No PostCSS Config found in:XXX

解决方法:
根目录下创建postcss.config.js文件
postcss.config.js中写
module.exports = { 
    plugins: { 
        'autoprefixer': {browsers: 'last 5 version'} 
    } 
}好爽 !!!
background-color: blue;background-color: yellow;<input type="button" value="变蓝" @click="changeColorT