Skip to content

Commit

Permalink
fix(vite.config.ts): generated .d.cts files should reference their .c…
Browse files Browse the repository at this point in the history
…js file counterparts
  • Loading branch information
waldronmatt committed May 31, 2024
1 parent a6d37cc commit f97efae
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/ui/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,11 @@ export default defineConfig({
// Update sourceMappingURL references
if (newFilePath.endsWith('.d.cts')) {
const content = await fs.readFile(newFilePath, 'utf-8');
const updatedContent = content.replace(/\/\/# sourceMappingURL=.*\.d\.ts\.map/g, (match) =>
let updatedContent = content.replace(/\/\/# sourceMappingURL=.*\.d\.ts\.map/g, (match) =>
match.replace('.d.ts.map', '.d.cts.map'),
);
// Update .js references to .cjs
updatedContent = updatedContent.replace(/(from\s+['"].*?)\.js(['"])/g, '$1.cjs$2');
await fs.writeFile(newFilePath, updatedContent, 'utf-8');
}

Expand Down

0 comments on commit f97efae

Please sign in to comment.