-
Notifications
You must be signed in to change notification settings - Fork 14
/
webpack.config.js
64 lines (63 loc) · 1.42 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
/* eslint-disable import/no-extraneous-dependencies */
const path = require('path');
const TerserPlugin = require('terser-webpack-plugin');
module.exports = {
mode: 'production',
entry: path.join(
__dirname,
'src',
'javascripts',
'crosswords',
'crossword.js',
),
externals: {
react: 'react',
'react-dom': 'react-dom',
},
output: {
filename: 'index.js',
path: path.join(__dirname, 'lib'),
libraryTarget: 'commonjs2',
},
resolve: {
modules: [
path.join(__dirname, 'src', 'javascripts'),
path.join(__dirname, 'src', 'stylesheets'),
'node_modules', // default location, but we're overiding above, so it needs to be explicit
],
alias: {
svgs: path.join(__dirname, 'src', 'svgs'),
},
},
resolveLoader: {
modules: [
'node_modules',
],
},
module: {
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
loader: 'babel-loader',
},
{
test: /\.svg$/,
exclude: /node_modules/,
loader: 'svg-inline-loader',
},
{
test: /\.scss$/,
use: [
'style-loader', // creates style nodes from JS strings
'css-loader', // translates CSS into CommonJS
'sass-loader', // compiles Sass to CSS, using Node Sass by default
],
},
],
},
optimization: {
minimize: true,
minimizer: [new TerserPlugin()],
},
};