-
Notifications
You must be signed in to change notification settings - Fork 6
/
webpack.base.js
42 lines (41 loc) · 947 Bytes
/
webpack.base.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
const CopyWebpackPlugin = require('copy-webpack-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports = {
entry: {
index: './src/index.js',
},
output: {
filename: 'js/[name].js',
path: './release',
publicPath: '/',
},
plugins: [
new CopyWebpackPlugin([
{ context: './src/static', from: '**/*', to: './' }, //copy all static files to release
]),
new HtmlWebpackPlugin({
template: 'src/html/index.ejs',
inject: false,
}),
],
resolve: {
extensions: ['', '.js', '.jsx'],
},
module: {
loaders: [
{
test: /\.jsx?$/,
exclude: /(node_modules|bower_components)/,
loader: 'babel-loader',
},
{
test: /\.(jpg|png|gif)$/,
loader: 'url-loader?limit=30000&name=img/[name].[ext]',
},
{
test: /\.svg$/,
loader: 'file-loader?name=img/[name].[ext]',
},
],
},
};