diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..b58b603 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,5 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ diff --git a/.idea/alias-fix.iml b/.idea/alias-fix.iml new file mode 100644 index 0000000..0c8867d --- /dev/null +++ b/.idea/alias-fix.iml @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml new file mode 100644 index 0000000..3240397 --- /dev/null +++ b/.idea/codeStyles/Project.xml @@ -0,0 +1,63 @@ + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/codeStyles/codeStyleConfig.xml b/.idea/codeStyles/codeStyleConfig.xml new file mode 100644 index 0000000..79ee123 --- /dev/null +++ b/.idea/codeStyles/codeStyleConfig.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 0000000..03d9549 --- /dev/null +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..bb3786f --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/src/index.ts b/src/index.ts index 5bf7fb6..c673c53 100644 --- a/src/index.ts +++ b/src/index.ts @@ -42,7 +42,7 @@ function findImports(line: string): string[] | null { function resolveImports( file: ReadonlyArray, imports: FileData[], - options: ts.CompilerOptions + options: ts.CompilerOptions & { cwd: string } ): string[] { const { baseUrl, paths, cwd } = options @@ -141,8 +141,6 @@ const alias: AliasPlugin = ({ config, cwd }: PluginOptions) => { compilerOptions.baseUrl = './' } - compilerOptions.cwd = cwd - return new Transform({ objectMode: true, transform(file: File, encoding: BufferEncoding, callback: TransformCallback) { @@ -168,7 +166,7 @@ const alias: AliasPlugin = ({ config, cwd }: PluginOptions) => { return callback(undefined, file) } - const resolved = resolveImports(lines, imports, compilerOptions) + const resolved = resolveImports(lines, imports, { ...compilerOptions, cwd }) file.contents = Buffer.from(resolved.join('\n'))