diff --git a/index.ts b/index.ts index e6f6109e8..f688196c7 100644 --- a/index.ts +++ b/index.ts @@ -496,7 +496,8 @@ function ensureTypeScriptInstance(loaderOptions: LoaderOptions, loader: any): { let output = languageService.getEmitOutput(filePath); let declarationFile = output.outputFiles.filter(filePath => !!filePath.name.match(/\.d.ts$/)).pop(); if (declarationFile) { - compilation.assets[declarationFile.name] = { + let assetPath = path.relative(process.cwd(), declarationFile.name); + compilation.assets[assetPath] = { source: () => declarationFile.text, size: () => declarationFile.text.length };