File tree Expand file tree Collapse file tree 5 files changed +1103
-71
lines changed Expand file tree Collapse file tree 5 files changed +1103
-71
lines changed Original file line number Diff line number Diff line change
1
+ {
2
+ "$schema" : " https://json.schemastore.org/swcrc" ,
3
+ "sourceMaps" : true ,
4
+ "module" : {
5
+ "type" : " commonjs" ,
6
+ "strict" : true ,
7
+ "strictMode" : true
8
+ },
9
+ "jsc" : {
10
+ "parser" : {
11
+ "syntax" : " typescript" ,
12
+ "decorators" : true ,
13
+ "dynamicImport" : true
14
+ },
15
+ "transform" : {
16
+ "legacyDecorator" : true ,
17
+ "decoratorMetadata" : true
18
+ },
19
+ "target" : " es2021"
20
+ },
21
+ "minify" : true
22
+ }
Original file line number Diff line number Diff line change 5
5
"projectType" : " application" ,
6
6
"tags" : [],
7
7
"targets" : {
8
+ "build" : {
9
+ "executor" : " @nx/js:swc" ,
10
+ "outputs" : [
11
+ " {options.outputPath}"
12
+ ],
13
+ "defaultConfiguration" : " production" ,
14
+ "options" : {
15
+ "target" : " node" ,
16
+ "compiler" : " swc" ,
17
+ "swcrc" : " .swcrc" ,
18
+ "outputPath" : " dist/nxnest-demo" ,
19
+ "main" : " apps/app/src/main.ts" ,
20
+ "tsConfig" : " apps/app/tsconfig.app.json" ,
21
+ "assets" : [
22
+ " src/assets"
23
+ ],
24
+ "isolatedConfig" : true
25
+ },
26
+ "configurations" : {
27
+ "development" : {
28
+ "swcrc" : " .swcrc"
29
+ },
30
+ "production" : {
31
+ "swcrc" : " .swcrc"
32
+ }
33
+ }
34
+ },
8
35
"serve" : {
9
36
"executor" : " @nx/js:node" ,
10
37
"defaultConfiguration" : " development" ,
21
48
}
22
49
}
23
50
}
24
- }
51
+ }
Original file line number Diff line number Diff line change 1
1
const { join } = require ( 'path' )
2
+ const swcDefaultConfig =
3
+ require ( '@nestjs/cli/lib/compiler/defaults/swc-defaults' ) . swcDefaultsFactory ( )
4
+ . swcOptions
2
5
const { NxAppWebpackPlugin } = require ( '@nx/webpack/app-plugin' )
6
+ const { merge } = require ( 'webpack-merge' )
3
7
4
- module . exports = {
5
- output : {
6
- path : join ( __dirname , '../../dist/apps/app' )
7
- } ,
8
- plugins : [
9
- new NxAppWebpackPlugin ( {
10
- target : 'node' ,
11
- compiler : 'tsc' ,
12
- main : './src/main.ts' ,
13
- tsConfig : './tsconfig.app.json' ,
14
- assets : [ './src/assets' ] ,
15
- optimization : false ,
16
- outputHashing : 'none'
17
- } )
18
- ]
8
+ module . exports = ( ) => {
9
+ // Get the base Nx webpack config
10
+ const baseConfig = {
11
+ output : {
12
+ path : join ( __dirname , '../../dist/apps/app' )
13
+ } ,
14
+ plugins : [
15
+ new NxAppWebpackPlugin ( {
16
+ target : 'node' ,
17
+ compiler : 'swc' ,
18
+ main : './src/main.ts' ,
19
+ tsConfig : './tsconfig.app.json' ,
20
+ assets : [ './src/assets' ] ,
21
+ optimization : false ,
22
+ outputHashing : 'none'
23
+ } )
24
+ ]
25
+ }
26
+
27
+ // Modify the base config to use swc-loader
28
+ const customConfig = {
29
+ module : {
30
+ rules : [
31
+ {
32
+ test : / \. t s ? $ / ,
33
+ exclude : / n o d e _ m o d u l e s / ,
34
+ use : {
35
+ loader : 'swc-loader' ,
36
+ options : swcDefaultConfig
37
+ }
38
+ }
39
+ ]
40
+ }
41
+ }
42
+
43
+ return merge ( baseConfig , customConfig )
19
44
}
Original file line number Diff line number Diff line change 22
22
"tslib" : " ^2.6.2"
23
23
},
24
24
"devDependencies" : {
25
+ "@nestjs/cli" : " ^10.3.2" ,
25
26
"@nestjs/schematics" : " ^10.1.1" ,
26
27
"@nestjs/testing" : " ^10.3.9" ,
27
28
"@nx/eslint" : " 19.1.2" ,
34
35
"@nx/webpack" : " 19.1.2" ,
35
36
"@nx/workspace" : " 19.1.2" ,
36
37
"@swc-node/register" : " ~1.9.1" ,
37
- "@swc/core" : " ~1.5.24" ,
38
- "@swc/helpers" : " ~0.5.11" ,
38
+ "@swc/cli" : " ^0.3.12" ,
39
+ "@swc/core" : " ^1.5.24" ,
40
+ "@swc/helpers" : " ^0.5.11" ,
39
41
"@types/jest" : " ^29.5.12" ,
40
42
"@types/node" : " ~20.14.0" ,
41
43
"@typescript-eslint/eslint-plugin" : " ^7.12.0" ,
54
56
"jest-environment-node" : " ^29.7.0" ,
55
57
"nx" : " 19.1.2" ,
56
58
"prettier" : " ^3.3.0" ,
59
+ "swc-loader" : " ^0.2.6" ,
57
60
"ts-jest" : " ^29.1.4" ,
58
61
"ts-node" : " 10.9.2" ,
59
62
"typescript" : " ~5.4.5" ,
You can’t perform that action at this time.
0 commit comments