-
Notifications
You must be signed in to change notification settings - Fork 40
Expand file tree
/
Copy pathwebpack.config.js
More file actions
79 lines (61 loc) · 1.73 KB
/
webpack.config.js
File metadata and controls
79 lines (61 loc) · 1.73 KB
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
var webpack = require('webpack');
var outputPath = __dirname + '/dev',
outputPublicPath = 'http://localhost:3000/scripts/';
var resolveCommon = {
// Allow to omit extensions when requiring these files
extensions: ['', '.js', '.jsx']
};
var moduleCommon = {
loaders: [
// Pass *.css files through css-loader and style-loader transforms
{ test: /\.css$/, loader: 'style!css' },
// Pass *.jsx files through jsx-loader transform
{ test: /\.jsx$/, loaders: ['react-hot', 'jsx'] },
{ test: /\.html$/, loader: 'raw' },
{ test: /\.md$/, loader: 'raw!markdown' },
]
};
module.exports = [
{
name: 'browser',
// Entry point for static analyzer:
entry: [
'webpack-dev-server/client?http://localhost:3000',
'webpack/hot/dev-server',
'./dev/entry.jsx'
],
output: {
// Where to put build results when doing production builds:
path: outputPath,
// JS filename you're going to use in HTML
filename: 'bundle.js',
// Path you're going to use in HTML
publicPath: outputPublicPath,
},
plugins: [
new webpack.HotModuleReplacementPlugin()
],
resolve: resolveCommon,
module: moduleCommon
},
{
name: 'server',
target: 'node',
// Entry point for static analyzer:
entry: {
bundlePage: './dev/page.jsx',
bundleStaticPage: './dev/staticPage.jsx'
},
output: {
// Where to put build results when doing production builds:
path: outputPath,
// JS filename you're going to use in HTML
filename: '[name].js',
// Path you're going to use in HTML
publicPath: outputPublicPath,
libraryTarget: "commonjs2"
},
resolve: resolveCommon,
module: moduleCommon
}
];