forked from voteflux/flux-website-v2
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathwebpack.config.js
More file actions
56 lines (52 loc) · 1.57 KB
/
webpack.config.js
File metadata and controls
56 lines (52 loc) · 1.57 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
var webpack = require('webpack');
var HtmlWebpackPlugin = require('html-webpack-plugin');
var CopyWebpackPlugin = require('copy-webpack-plugin');
var path = require('path');
// plugins
var HtmlWebpackPluginConfig = new HtmlWebpackPlugin({
hash: true,
cache: false,
template: __dirname + '/react-signup/app/index.html',
filename: 'index.html',
inject: 'body'
});
// definePlugin takes raw strings and inserts them, so you can put strings of JS if you want.
var definePlugin = new webpack.DefinePlugin({
__DEV__: JSON.stringify(JSON.parse(process.env.BUILD_DEV || 'false')),
__PRERELEASE__: JSON.stringify(JSON.parse(process.env.BUILD_PRERELEASE || 'false')),
'process.env': {NODE_ENV: '"production"'}
});
var entryPath = './react-signup/app/';
var outputPath = './signup/';
var CopyWebpackPluginConfig = new CopyWebpackPlugin([
{ from: './react-signup/css', to: outputPath + 'css' },
{ from: './react-signup/img', to: outputPath + 'img' }
]);
module.exports = {
// context: path.join(__dirname, 'app'),
devServer: {
// This is required for webpack-dev-server. The path should
// be an absolute path to your build destination.
outputPath: path.join(__dirname, outputPath)
},
entry: [
'./react-signup/app/index.js'
],
output: {
path: outputPath,
filename: "index_bundle.js"
},
module: {
loaders: [
{ test:/\.js$/,
exclude: /node_modules/,
loader: "babel-loader"
}
]
},
plugins: [
HtmlWebpackPluginConfig,
CopyWebpackPluginConfig, // comment this out when in dev-mode
definePlugin
]
};