-
Notifications
You must be signed in to change notification settings - Fork 8
/
webpack.config.js
34 lines (31 loc) · 992 Bytes
/
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
const path = require('path');
const sourcePath = path.resolve(__dirname, 'src/main/assets/js');
const govukFrontend = require(path.resolve(__dirname, 'webpack/govukFrontend'));
const scss = require(path.resolve(__dirname, 'webpack/scss'));
const HtmlWebpack = require(path.resolve(__dirname, 'webpack/htmlWebpack'));
const devMode = process.env.NODE_ENV !== 'production';
const fileNameSuffix = devMode ? '-dev' : '.[contenthash]';
const filename = `[name]${fileNameSuffix}.js`;
module.exports = {
plugins: [...govukFrontend.plugins, ...scss.plugins, ...HtmlWebpack.plugins],
entry: path.resolve(sourcePath, 'index.ts'),
mode: devMode ? 'development' : 'production',
module: {
rules: [
...scss.rules,
{
test: /\.ts$/,
use: 'ts-loader',
exclude: /node_modules/,
},
],
},
resolve: {
extensions: ['.ts', '.js'],
},
output: {
path: path.resolve(__dirname, 'src/main/public/'),
publicPath: '',
filename,
},
};