728x90
ReactJS - Code Splitting _webpack Prodo
webpack environment
~cra-router/config$ webpack.config.prod.js : entry
entry: {
vendor: [
require.resolve('./polyfills'),
'react',
'react-dom',
'react-router-dom',
],
app: paths.appIndexJs,
}
pages를 불러올 때 이를 자동으로 pages/index.async.js로 차환하도록 설정
~cra-router/config$ webpack.config.prod.js : plugins
plugins: [
new webpack.NormalModuleReplacementPlugin(
/^pages$/,
'pages/index.adync.js',
),
new webpack.optimize.CommonsChunkPlugin({
name: 'vendor'
}),
new ModuleScopePlugin(paths.appSrc, [paths.appPackageJson]),
],
배포 : yarn build
static server install : yarn global add serve
static server service : serve -s build
http://localhost:5000 으로 서버에 접속할 수 있다.
'my_lesson > _ReactJS' 카테고리의 다른 글
React-router - Server side Rendering _특징 (0) | 2018.04.14 |
---|---|
React-router - react-hot-loader (0) | 2018.04.14 |
React-router - Code Splitting _route code splitting asyncComponent (0) | 2018.04.13 |
React-router - CodeSplitting(prodoction) _ Create chunk (0) | 2018.04.12 |
React-router - Code Splitting(prodoction) _Environment (0) | 2018.04.12 |
댓글