-
Notifications
You must be signed in to change notification settings - Fork 2
/
webpack.config.js
77 lines (73 loc) · 1.8 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
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
// webpack.config.js
require('babel-polyfill');
var webpack = require('webpack');
var ExtractTextPlugin = require('extract-text-webpack-plugin');
const UglifyJSPlugin = require('uglifyjs-webpack-plugin');
module.exports = {
entry: [
'babel-polyfill',
'whatwg-fetch',
'./source/javascripts/main.js',
'./source/scss/main.scss',
],
plugins: [
new ExtractTextPlugin('bundle.styles.css'),
new webpack.ProvidePlugin({
$: "jquery",
jQuery: "jquery",
"window.jQuery": "jquery",
Tether: 'tether',
}),
new UglifyJSPlugin(),
],
output: {
path: __dirname + '/source/dist',
filename: '[name].js',
},
module: {
loaders: [
{
test: /\.(png|jpg)$/,
loader: 'file-loader',
query: {
name: 'images/[name].[ext]'
}
},
{
test: /\.(woff|woff2|eot|ttf|svg)$/,
use: [{
loader: 'file-loader',
}],
},
{ // Load support for ES6
test: /\.js$/,
exclude: /node_modules|\.tmp|vendor/,
loader: 'babel-loader',
options: {
babelrc: false,
plugins: ["transform-runtime"],
presets: ['es2015', 'stage-0'],
}
},
{ // Load SASS pre processed CSS
test: /\.scss$/,
use: [ {
loader: 'resolve-url-loader',
}, {
loader: 'style-loader', // inject CSS to page
}, {
loader: 'css-loader', // translates CSS into CommonJS modules
}, {
loader: 'sass-loader' // compiles SASS to CSS
}],
},
{ // Load plain-ol' vanilla CSS
test: /\.css$/,
use: ExtractTextPlugin.extract({
fallback: 'style-loader!resolve-url-loader',
use: 'css-loader!resolve-url-loader'
})
},
],
}
};