-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.production.config.js
More file actions
112 lines (104 loc) · 3.57 KB
/
Copy pathwebpack.production.config.js
File metadata and controls
112 lines (104 loc) · 3.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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
var path = require('path');
// var node_modules = path.resolve(__dirname, 'node_modules');
// var pathToReact = path.resolve(node_modules, 'react/dist/react-with-addons.js');
var HtmlWebpackPlugin = require('html-webpack-plugin');
var ExtractTextPlugin = require("extract-text-webpack-plugin");
var webpack = require("webpack");
console.log(' process.env.NODE_ENV> ', process.env.NODE_ENV);
module.exports = {
context: __dirname + "/src",
entry: [ path.resolve(__dirname, 'src/main')],
resolve: {
root: path.resolve(__dirname, 'src'),
// alias: {
// 'react': pathToReact
// },
extensions: ['', '.js', '.jsx', '.styl']
},
// externals: {
// "react": "React",
// "react/addons": "React"
// },
output: {
path: path.resolve(__dirname, 'dist'),
publicPath : 'http://localhost:7000/',
filename: 'app.[hash].js'
},
devtool: 'source-map',
// modulesDirectories: ['node_modules', 'web_modules', 'bower_components'],
module: {
loaders: [
{
test: /\.jsx?$/, // A regexp to test the require path. accepts either js or jsx
loader: 'babel' // The module to load. "babel" is short for "babel-loader"
,
exclude: /(node_modules|bower_components)/
},
{
test: /\.css$/, // Only .css files
loader: ExtractTextPlugin.extract('style-loader', 'css-loader') // Run both loaders
},
{
test: /\.styl$/,
loader: ExtractTextPlugin.extract("stylus", "css-loader!stylus-loader")
},
{
test: /\.scss$/,
loader: ExtractTextPlugin.extract([ "css-loader!sass-loader"])
},
{
test: /\.json$/,
loader: 'json'
},
{
test: /\.woff(\d+)?$/,
loader: 'url-loader?mimetype=application/font-woff'
},
{
// loader: 'file-loader?name=images/[name].[ext]'
test: /\.(jpe?g|png|gif|svg)$/i,
loaders: [
'file?hash=sha512&digest=hex&name=images/[hash].[ext]',
'image-webpack?bypassOnDebug&optimizationLevel=7&interlaced=false'
]
},
{ test: /\.ttf$/, loader: "file-loader" }
// {
// test: /\.styl$/,
// loader: 'style-loader!css-loader!stylus-loader'
// },
// {
// test: /\.woff(\d+)?$/,
// loader: 'url-loader?mimetype=application/font-woff'
// },
// { test: /\.ttf$/, loader: "file-loader" },
// { test: /\.eot$/, loader: "file-loader" },
// { test: /\.svg$/, loader: "file-loader" }
]
//, noParse: [pathToReact]
},
plugins: [
new ExtractTextPlugin("app.[hash].css",{
allChunks: true
}),
new HtmlWebpackPlugin({
template: './index.html',
production: true,
}),
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV || 'development')
}),
new webpack.optimize.DedupePlugin(),
new webpack.ProvidePlugin({
$: "jquery",
jQuery: "jquery",
"window.jQuery": "jquery"
}),
new webpack.ContextReplacementPlugin(/moment[\/\\]locale$/, /de|fr|hu/)
]
// , devServer: {
// proxy: {
// '*': 'http://localhost:8000'
// }
// }
};