-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.dev.js
69 lines (64 loc) · 2.26 KB
/
webpack.config.dev.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
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
const { resolve } = require('path');
const webpack = require("webpack");
const CopyWebpackPlugin = require('copy-webpack-plugin');
const production = process.env.NODE_ENV === 'production';
console.log(`Building for ${production ? 'production' : 'development'}`);
module.exports = {
devtool: 'source-map',
entry: {
vendor: ['react', 'react-dom', 'lodash'],
application: './app/src/index.js',
},
output: {
path: resolve(__dirname, 'build'),
publicPath: '/',
filename: '[name].js',
},
resolve: {
// Allowed implicit extensions for require/import
extensions: ['.js', '.jsx']
},
plugins: [
new webpack.optimize.CommonsChunkPlugin({
names: ['vendor'],
minChunks: Infinity,
}),
new CopyWebpackPlugin([
{ context: 'node_modules/@anyware/sound-assets',
from: '**/*.wav',
to: 'sounds',
},
{ context: 'static/app-icons',
from: '*.png',
to: 'images'
},
{ context: 'static/images',
from: '*.png',
to: 'images'
},
{ from: 'app/application.html' },
{ from: 'app/application.css' },
{ from: 'app/config.js' },
{ from: 'manifest.json' },
{ from: `scripts/background${production ? '-production' : ''}.js`,
to: 'background.js' },
]),
],
module: {
rules: [
{ test: /\.jsx?$/,
exclude: /node_modules/,
use: ['babel-loader'],
},
// General purpose CSS loader, needed by e.g. react-bootstrap-table
{ test: /\.css$/, use: ['style-loader', 'css-loader'] },
// General purpose LESS loader, needed by e.g. bootstrap and our own less stylesheets
{ test: /\.less$/, use: ['style-loader', 'css-loader', 'less-loader'] },
// The following 5 rules are needed by bootstrap
{ test: /\.eot(\?v=\d+\.\d+\.\d+)?$/, use: ['file-loader'] },
{ test: /\.(woff|woff2)(\?v=\d+\.\d+\.\d+)?$/, use: [{loader: 'url-loader', options: {limit: 10000, mimetype: 'application/font-woff'}}] },
{ test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/, use: [{loader: 'url-loader', options: {limit: 10000, mimetype: 'application/octet-stream'}}] },
{ test: /\.svg$/, use: ['babel-loader', {loader: 'react-svg-loader', options: {jsx: true, svgo: {plugins: [{cleanupIDs: false}]}}}] },
]
}
};