-
Notifications
You must be signed in to change notification settings - Fork 26
Expand file tree
/
Copy pathwebpack.example.config.js
More file actions
52 lines (50 loc) · 1.21 KB
/
webpack.example.config.js
File metadata and controls
52 lines (50 loc) · 1.21 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
const path = require('path');
const webpack = require('webpack')
let entry = {};
entry['example'] = [path.resolve(__dirname, 'example/js/app')];
entry['example-alt'] = [path.resolve(__dirname, 'example-alt/js/app')];
module.exports = {
context: path.resolve(__dirname),
entry: entry,
output: {
path: path.join(__dirname, 'dist'),
filename: '[name].js'
},
module: {
loaders: [
// Transform JSX in .jsx files
{ test: /\.jsx?$/, exclude: /node_modules/, loader: 'babel-loader' },
{ test: /\.css$/, loader:'style!css!' }
],
rules: [
{
test: /\.less$/,
use: [
'style-loader',
{ loader: 'css-loader', options: { importLoaders: 1 } },
'less-loader'
]
}
]
},
resolve: {
// Allow require('./blah') to require blah.jsx
extensions: ['', '.js', '.jsx']
},
externals: {
// Use external version of React (from CDN for client-side, or
// bundled with ReactJS.NET for server-side)
'react': 'React',
'react-dom': 'ReactDOM'
},
plugins: [
new webpack.DefinePlugin({
'process.env': {
'NODE_ENV': JSON.stringify('production')
}
}),
new webpack.optimize.UglifyJsPlugin({
compress: { warnings: false }
})
]
}