-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.common.babel.js
41 lines (40 loc) · 1.05 KB
/
webpack.config.common.babel.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
// @flow
import path from 'path';
import { WDS_PORT } from './src/shared/config';
import { isProd } from './src/shared/util';
export default {
entry: [
// Starting point of app
'react-hot-loader/patch',
'./src/client'
],
output: {
filename: 'js/bundle.js', // name of the bundle to generate
path: path.resolve(__dirname, 'dist'), // Destination folder
publicPath: isProd ? '/static/' : `http://localhost:${WDS_PORT}/dist/` // URL
},
module: {
rules: [
// Tells all .js and .jsx files to go through babel-loader.
{ test: /\.(js|jsx)$/, use: 'babel-loader', exclude: /node_modules/ },
{
test: /\.css$/,
use: [
{ loader: 'style-loader' },
{ loader: 'css-loader', options: { importLoaders: 1 } },
'postcss-loader'
]
}
]
},
resolve: {
extensions: ['.js', '.jsx', '.css']
},
devtool: 'source-map',
devServer: {
// port for dev server
port: WDS_PORT,
hot: isProd ? false : true,
headers: { 'Access-Control-Allow-Origin': '*' }
}
};