-
Notifications
You must be signed in to change notification settings - Fork 5
/
webpack.config.js
66 lines (63 loc) · 1.96 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
const
path = require('path'),
webpack = require('webpack'),
pkg = require('./package.json'),
dotenv = require('dotenv'),
ExtractTextPlugin = require('extract-text-webpack-plugin');
dotenv.config();
const DEBUG = process.env.DEBUG;
module.exports = {
entry: './public/js/app.js',
output: {
path: path.resolve(__dirname, 'public/dist'),
filename: 'bundle.js',
},
module: {
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
loader: 'babel-loader',
options: {
plugins: [
'transform-runtime',
'transform-object-rest-spread',
],
presets: ['es2015'],
},
},
{
test: /\.scss$/,
exclude: /node_modules\/(?!materialize-css)/,
loaders: ExtractTextPlugin.extract({
fallback: 'style-loader', // The backup style loader
use: [
'css-loader?sourceMap',
'postcss-loader',
'sass-loader?sourceMap',
],
}),
},
{
test: /\.(eot|svg|ttf|woff|woff2)$/,
exclude: /node_modules/,
use: 'file-loader?name=dist/fonts/[name].[ext]',
},
],
},
resolve: {
modules: [
path.resolve(__dirname, './js'),
path.resolve(__dirname, './node_modules'),
],
extensions: ['.js', '.jsx', '.json', '.css'],
},
plugins: [
new webpack.DefinePlugin({
VERSION: JSON.stringify(pkg.version),
}),
new ExtractTextPlugin('styles.css'),
],
target: 'web',
devtool: DEBUG ? 'inline-source-map' : false,
};