-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwebpack.config.js
47 lines (46 loc) · 1.66 KB
/
webpack.config.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
var path = require('path');
var webpack = require('webpack');
var HtmlWebpackPlugin = require('html-webpack-plugin');
var ExtractTextPlugin = require('extract-text-webpack-plugin');
module.exports = {
entry: {
index: path.join(__dirname, './', 'app/assets/javascript/main.js'),
vendor: ['underscore']
},
output: {
filename: 'assets/javascript/[name]-[hash].js',
path: path.join(__dirname, './', 'build'),
publicPath: '/'
},
module: {
loaders: [
{ test: /\.js$/, exclude: /node_modules/, loader: 'babel-loader', query: { presets: ['es2015', 'react'], compact: true } },
{ test: /\.css/, loader: ['style-loader', 'css-loader', 'sass-loader'] },
{ test: /\.sass$/, loaders: ['style-loader', 'css-loader', 'sass-loader'] },
{ test: /\.png|jpg|gif$/, loader: 'file-loader?name=assets/images/[name]-[hash].[ext]' },
{ test: /\.(woff|woff2|svg|ttf|eot|ico)$/, loader: 'file-loader?name=assets/fonts/[name].[ext]' }
]
},
plugins: [
new HtmlWebpackPlugin({
template: 'app/index.html',
filename: 'index.html',
chunks: ['index', 'vendor']
}),
new ExtractTextPlugin('assets/stylesheet/[name]-[hash].min.css'),
new webpack.ProvidePlugin({
React: 'react',
$: 'jquery',
jquery: 'jquery',
underscore: 'underscore'
})
],
stats: {
colors: true
},
devtool: 'source-map',
resolve: {
extensions: ['.js', '.sass'],
modules: ['app', 'node_modules']
}
};