Skip to content

Commit

Permalink
fix(swc): disable paths mapping on windows
Browse files Browse the repository at this point in the history
  • Loading branch information
kamilmysliwiec committed Aug 25, 2023
1 parent 4747852 commit 0cc6c92
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions lib/compiler/defaults/swc-defaults.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { platform } from 'process';
import * as ts from 'typescript';
import { Configuration } from '../../configuration';

Expand All @@ -10,6 +11,15 @@ export const swcDefaultsFactory = (
? configuration?.compilerOptions?.builder?.options
: {};

// swc does not currently support paths mapping on Windows
// see https://github.com/nestjs/nest-cli/issues/2211
const pathsMappingOptions = platform?.startsWith('win')
? {}
: {
baseUrl: tsOptions?.baseUrl,
paths: tsOptions?.paths,
};

return {
swcOptions: {
module: {
Expand All @@ -28,8 +38,7 @@ export const swcDefaultsFactory = (
useDefineForClassFields: false,
},
keepClassNames: true,
baseUrl: tsOptions?.baseUrl,
paths: tsOptions?.paths,
...pathsMappingOptions,
},
minify: false,
swcrc: true,
Expand Down

0 comments on commit 0cc6c92

Please sign in to comment.