构建最新版本的React时遇到问题。 当我运行npm run build时,它会分块地构建。
构建结果:
File sizes after gzip:
34.45 KB build/static/js/1.2dd891c4.chunk.js
763 B build/static/js/runtime~main.229c360f.js
711 B build/static/js/main.f219991b.chunk.js
509 B build/static/css/main.ef7da6c0.chunk.css
我没有使用webpack,也没有进行任何修改。我使用create-react-app安装了它。 这是我的package.json:
{
"name": "react-test",
"version": "0.1.0",
"private": true,
"dependencies": {
"react": "^16.6.3",
"react-dom": "^16.6.3",
"react-scripts": "2.1.1"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": "react-app"
},
"browserslist": [
">0.2%",
"not dead",
"not ie <= 11",
"not op_mini all"
]
}
如何强制React构建为以下格式:
711 B build/static/js/main.f219991b.js
509 B build/static/css/main.ef7da6c0.css
链接到包含构建文件的存储库: https://github.com/Tararan/joes-coffee-store