- mui.css引入到脚手架,打包时会报SVG图片属性错误(需要将mui.css文件中引入SVG图片的单引号改成双引号)
- mui严格模式(当webpack项目中引入mui.js,会报caller,callee,arguments在严格模式下无法使用的错误)
解决方式:
真正问题产生是由于babel-loader在编译代码时会加严格模式限制
方法一: .babelrc文件中忽略不需要使用严格模式转换的文件路径
“ignore”: [
“./src/js/mui/mui.min.js”
]
方法二: babel-loader配置中排除掉不需要严格模式转换的文件
{
test: /.jsKaTeX parse error: Can't use function '\.' in math mode at position 46: … exclude: /mui\̲.̲min\.js/
** exclude:["./src/js/mui/mui.min.js"]
}
方法三: babel-plugin-transform-remove-strict-mode 移除整个项目打包编译时的严格模式
https://www.npmjs.com/package/babel-plugin-transform-remove-strict-mode
-
安装babel-plugin-transform-remove-strict-mode
npm install babel-plugin-transform-remove-strict-mode --save-dev -
babelrc中添加
{
“plugins”: [“transform-remove-strict-mode”]
}