-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.babel.js
88 lines (87 loc) · 2.37 KB
/
webpack.config.babel.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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
const path = require('path');
const webpack = require('webpack');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
module.exports = {
context: path.resolve(__dirname, './src'),
devtool: 'inline-source-map',
entry: {
app: './app.js',
vendor: ['jquery', 'mercury'],
},
output: {
path: path.resolve(__dirname, './dist/assets'),
publicPath: '/assets', // New
filename: "[name].bundle.js",
},
devServer: {
host: 'localhost',
port: 3000,
open: true,
historyApiFallback: true,
watchOptions: {
aggregateTimeout: 300,
poll: 1000
},
contentBase: path.resolve(__dirname, './src'), // New
},
module: {
rules: [
{
test: /\.js$/,
exclude: [/node_modules/],
use: [{
loader: 'babel-loader',
options: {presets: ['es2015', 'stage-0']}
}],
},
{
test: /\.css$/,
loader: 'style-loader!css-loader?sourceMap'
},
{
test: /\.woff(\?v=\d+\.\d+\.\d+)?$/,
loader: "url-loader?limit=10000&mimetype=application/font-woff"
}, {
test: /\.woff2(\?v=\d+\.\d+\.\d+)?$/,
loader: "url-loader?limit=10000&mimetype=application/font-woff"
}, {
test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/,
loader: "url-loader?limit=10000&mimetype=application/octet-stream"
}, {
test: /\.eot(\?v=\d+\.\d+\.\d+)?$/,
loader: "file-loader"
}, {
test: /\.svg(\?v=\d+\.\d+\.\d+)?$/,
loader: "url-loader?limit=10000&mimetype=image/svg+xml"
},
{
test: /\.less$/,
use: [{
loader: "style-loader" // creates style nodes from JS strings
}, {
loader: "css-loader" // translates CSS into CommonJS
}, {
loader: "less-loader" // compiles Less to CSS
}]
},
{test: /\.(jpg|png|gif|eot|svg|ttf|woff|woff2)$/i,
exclude: [/node_modules/],
use: [{
loader: 'file-loader',
options: {name: '[name].[ext]', outputPath: path.resolve(__dirname, './dist/images')}
}]
}
]
},
resolve: {
modules: [path.resolve(__dirname, './src'), 'node_modules']
},
plugins: [
new ExtractTextPlugin('style.css'),
new webpack.optimize.CommonsChunkPlugin({
name: 'vendor',
filename: 'vendor.js',
minChunks: Infinity
}),
],
};