Skip to content

Commit

Permalink
fix: regression on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
wessberg committed Aug 3, 2023
1 parent 58c11cb commit 351bf26
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
1 change: 1 addition & 0 deletions src/service/emit/declaration/emit-declarations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ export function emitDeclarations(options: EmitDeclarationsOptions): void {
declarationDir: options.originalCompilerOptions.declarationDir,
outFile: setExtension(virtualOutFile.relative, JS_EXTENSION),
module: typescript.ModuleKind.System,
noEmit: false,
emitDeclarationOnly: true,

// This can cause TS2612 errors that wouldn't otherwise happen
Expand Down
8 changes: 6 additions & 2 deletions src/util/chunk/normalize-chunk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,19 @@ export function preNormalizeChunk(chunk: OutputChunk, otherChunks: OutputChunk[]

// Make sure to remove any base modules that are also entry modules in other chunks
for (const baseModule of baseModules) {
if (otherChunks.some(otherChunk => otherChunk.isEntry && otherChunk.facadeModuleId === baseModule)) {
if (
otherChunks.some(
otherChunk => otherChunk.isEntry && otherChunk.facadeModuleId != null && normalizeChunkFilename(otherChunk.facadeModuleId) === normalizeChunkFilename(baseModule)
)
) {
baseModules.delete(baseModule);
}
}

// Add the facadeModuleId to the base modules if it is an entry chunk and it wasn't already there.
// Since Rollup v3.22.0, the facadeModuleId may no longer be included in the modules of the chunk if it only contains imports/exports, so we'll have to add it manually
if (chunk.isEntry && chunk.facadeModuleId != null && !baseModules.has(chunk.facadeModuleId)) {
baseModules.add(chunk.facadeModuleId);
baseModules.add(normalizeChunkFilename(chunk.facadeModuleId));
}

return {
Expand Down
3 changes: 1 addition & 2 deletions test/allow-importing-ts-extensions.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ test.serial(
typescript,
rollup,
tsconfig: {
allowImportingTsExtensions: true,
noEmit: true
allowImportingTsExtensions: true
}
}
);
Expand Down

0 comments on commit 351bf26

Please sign in to comment.