-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.config.js
More file actions
49 lines (45 loc) · 1.3 KB
/
webpack.config.js
File metadata and controls
49 lines (45 loc) · 1.3 KB
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
import * as path from 'node:path';
import { fileURLToPath } from 'node:url';
import { virtualRoutes } from '@faergeek/fs-routes';
import makeWebpackConfig from '@faergeek/make-webpack-config';
const routesDir = path.resolve('workspace', 'app', 'routes');
/**
* @param {{ WEBPACK_WATCH?: boolean }} env
* @param {Record<string, unknown>} argv
*
* @returns {import('webpack').Configuration[]}
*/
export default function webpackConfig(env, argv) {
const dev = argv.configNodeEnv === 'development';
const watch = env.WEBPACK_WATCH;
return makeWebpackConfig({
analyze: !dev,
cache: {
type: 'filesystem',
buildDependencies: {
config: [
fileURLToPath(import.meta.url),
'./.browserslistrc',
'./.swcrc',
],
},
},
dev,
node: {
entry: '@workspace/node',
outputPath: path.resolve('workspace', 'node', 'dist'),
},
nodeArgs: ['--enable-source-maps', '--inspect=9229'],
plugins: () => [virtualRoutes(routesDir)],
reactRefresh: true,
serviceWorker: {
entry: { sw: '@workspace/service-worker' },
outputPath: path.resolve('workspace', 'service-worker', 'dist'),
},
watch,
webPage: {
entry: '@workspace/web-page',
outputPath: path.resolve('workspace', 'web-page', 'dist'),
},
});
}