-
Notifications
You must be signed in to change notification settings - Fork 3
/
webpack.config.dev.mjs
55 lines (51 loc) · 1.33 KB
/
webpack.config.dev.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
import { join } from 'path';
import webpack from 'webpack';
import { merge } from 'webpack-merge';
import { setupFixturesServer } from './scripts/fixtures/fixtures-server.js';
import config from './webpack.config.mjs';
const { DefinePlugin, ProvidePlugin } = webpack;
const port = 3031;
const overrideBundlePath = `http://localhost:${port}/`;
const shouldOverrideBundle = !!process.env.OVERRIDE_BUNDLE;
// eslint-disable-next-line import/no-default-export -- webpack config
export default merge(config, {
devtool: 'inline-source-map',
mode: 'development',
output: {
filename: `graun.standalone.commercial.js`,
chunkFilename: `graun.[name].commercial.js`,
path: join(import.meta.dirname, 'dist', 'bundle', 'dev'),
clean: true,
},
plugins: shouldOverrideBundle
? [
new ProvidePlugin({
process: 'process/browser',
}),
new DefinePlugin({
'process.env.OVERRIDE_BUNDLE_PATH':
JSON.stringify(overrideBundlePath),
}),
]
: [
new ProvidePlugin({
process: 'process/browser',
}),
],
resolve: {
alias: {
process: 'process/browser',
},
},
/** @type {import('webpack-dev-server').Configuration} */
devServer: {
port,
compress: true,
hot: false,
liveReload: true,
setupMiddlewares: (middlewares, devServer) => {
setupFixturesServer(devServer);
return middlewares;
},
},
});