Skip to content
This repository was archived by the owner on May 8, 2018. It is now read-only.

Commit 1cafafd

Browse files
committed
feat(webpack_config): add basic webpack config for client
feat(webpack_config): add basic webpack config for client
1 parent b3761fe commit 1cafafd

1 file changed

Lines changed: 52 additions & 0 deletions

File tree

webpack_config/client/index.js

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
import path from 'path'
2+
import childProcess from 'child_process'
3+
import webpack from 'webpack'
4+
import config from '../config'
5+
import isomorphicWebpackConfig from '../webpack.isomorphic'
6+
import AssetsPlugin from 'assets-webpack-plugin'
7+
import WebpackAssetsManifest from 'webpack-assets-manifest'
8+
const {
9+
CLIENT_DIST_PATH,
10+
NODE_ENV,
11+
srcPath,
12+
distPath,
13+
publicPath,
14+
isProduction,
15+
title
16+
} = config
17+
18+
const exec = childProcess.execSync
19+
exec(`rm -rf ${CLIENT_DIST_PATH}`)
20+
21+
const definePluginArgs = {
22+
'process.env.BROWSER': JSON.stringify(true)
23+
}
24+
25+
const baseBuild = {
26+
name: 'client',
27+
entry: {
28+
client: path.join(srcPath, './client')
29+
},
30+
output: {
31+
filename: '[name].js',
32+
publicPath,
33+
path: CLIENT_DIST_PATH,
34+
chunkFilename: '[name].[chunkhash:6].js'
35+
},
36+
performance: {
37+
hints: false
38+
},
39+
resolve: {
40+
modules: isomorphicWebpackConfig.resolve.modules,
41+
extensions: isomorphicWebpackConfig.resolve.extensions.concat()
42+
},
43+
plugins: isomorphicWebpackConfig.plugins.concat([
44+
new webpack.DefinePlugin(definePluginArgs),
45+
new AssetsPlugin({
46+
path: CLIENT_DIST_PATH
47+
})
48+
]),
49+
target: 'web'
50+
}
51+
52+
export default baseBuild

0 commit comments

Comments
 (0)