forked from hmcts/pip-frontend
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
45 lines (41 loc) · 1.31 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
const path = require('path');
const sourcePath = path.resolve(__dirname, 'src/main/bundles');
const govukFrontend = require(path.resolve(__dirname, 'webpack/govukFrontend'));
const mojFrontend = require(path.resolve(__dirname, 'webpack/ministryOfJusticeFrontend'));
const scss = require(path.resolve(__dirname,'webpack/scss'));
const HtmlWebpack = require(path.resolve(__dirname,'webpack/htmlWebpack'));
const autocomplete = require(path.resolve(__dirname,'webpack/accessible-autocomplete'));
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,
...autocomplete.plugins,
...mojFrontend.plugins,
],
entry: {
main: path.resolve(sourcePath, 'index.js'),
alphabetical: path.resolve(sourcePath, 'alphabetical.ts' ),
} ,
mode: devMode ? 'development': 'production',
module: {
rules: [
...scss.rules,
{
test: /\.ts$/,
use: ['babel-loader', 'ts-loader'],
exclude: /node_modules/,
}],
},
resolve: {
extensions: ['.ts', '.js', '.json'],
},
output: {
path: path.resolve(__dirname, 'src/main/public/'),
publicPath: '',
filename,
},
};