Skip to content

Commit

Permalink
baseUrl
Browse files Browse the repository at this point in the history
  • Loading branch information
kdy1 authored and Brooooooklyn committed Aug 11, 2023
1 parent 555d17b commit b83eb2c
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/core/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export interface Options {
keepClassNames?: boolean
externalHelpers?: boolean
react?: Partial<ReactConfig>
baseUrl?: string
paths?: {
[from: string]: [string]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ test('default values', (t) => {
const filename = 'some-file.tsx'
const swcConfig = tsCompilerOptionsToSwcConfig(options, filename)
const expected = {
baseUrl: process.cwd(),
module: 'es6',
sourcemap: false,
experimentalDecorators: false,
Expand Down Expand Up @@ -92,6 +93,7 @@ test('should set all values', (t) => {
const filename = 'some-file.tsx'
const swcConfig = tsCompilerOptionsToSwcConfig(options, filename)
const expected = {
baseUrl: join(process.cwd(), options.baseUrl!),
module: 'commonjs',
sourcemap: 'inline',
target: 'es5',
Expand Down
1 change: 1 addition & 0 deletions packages/register/read-default-tsconfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ export function tsCompilerOptionsToSwcConfig(options: ts.CompilerOptions, filena
useBuiltins: true,
}
: undefined,
baseUrl: resolve(options.baseUrl ?? './'),
paths: Object.fromEntries(
Object.entries(options.paths ?? {}).map(([aliasKey, aliasPaths]) => [
aliasKey,
Expand Down

0 comments on commit b83eb2c

Please sign in to comment.