-
Notifications
You must be signed in to change notification settings - Fork 3
/
webpack.config.mjs
69 lines (67 loc) · 1.44 KB
/
webpack.config.mjs
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
import { join } from 'path';
import CircularDependencyPlugin from 'circular-dependency-plugin';
/**
* @type {import('webpack').Configuration}
*/
const config = {
entry: {
'commercial-standalone': join(
import.meta.dirname,
'src',
'commercial.ts',
),
},
output: {
path: join(import.meta.dirname, 'dist', 'bundle'),
clean: true,
},
resolve: {
modules: [
join(import.meta.dirname, 'src'),
'node_modules', // default location, but we're overiding above, so it needs to be explicit
],
alias: {
svgs: join(import.meta.dirname, 'static', 'svg'),
lodash: 'lodash-es',
},
extensions: ['.js', '.ts', '.tsx', '.jsx'],
},
module: {
rules: [
{
test: /\.[jt]sx?|mjs$/,
use: [
{
loader: 'babel-loader',
},
{
loader: 'ts-loader',
options: {
transpileOnly: true,
configFile: join(
import.meta.dirname,
'tsconfig.json',
),
},
},
],
},
{
test: /\.svg$/,
exclude: /(node_modules)/,
loader: 'raw-loader',
},
],
},
plugins: [
// eslint-disable-next-line @typescript-eslint/no-unsafe-call -- circular-dependency-plugin is not typed
new CircularDependencyPlugin({
// exclude detection of files based on a RegExp
exclude: /node_modules/,
// add errors to webpack instead of warnings
failOnError: true,
}),
],
};
// eslint-disable-next-line import/no-default-export -- webpack config
export default config;