react 打包遇到的问题
1.npm run build 打包后报错
Child html-webpack-plugin for “..\index.html”:1 asset
Entrypoint html-webpack-plugin for “..\index.html” = ../index.html
Child mini-css-extract-plugin node_modules/css-loader/index.js!node_modules/ivie
w/dist/styles/iview.css:
Entrypoint mini-css-extract-plugin = *
或者 报错 Entrypoint undefined = index.html
解决办法:
在webpack.config.js文件加上
stats: {
// One of the two if I remember right
entrypoints: false,
children: false
},
2.yarn start时许可证警告且下边有端口,可以看是否端口被占用
3.不识别 NODE_ENV=\”production\”
安装 npm install –save-dev cross-env (cross-env能跨平台地设置及使用环境变量)
在npm脚本(package.json)里这么使用:
6. serve -s build 会将打包后的东西在本地测试
7.若要在外部运行打包的东西需要服务器,放在tomcat 下 webapps 的ROOT目录下 然后运行端口。