From 41547e434d0ce3f21c7080531a99cb8801ad4167 Mon Sep 17 00:00:00 2001 From: Daniel Bayley Date: Sun, 30 Jun 2024 02:34:54 +0100 Subject: [PATCH] fix(repo) emit .d.mts file extension for esm --- shared/rollup.config.mjs | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) diff --git a/shared/rollup.config.mjs b/shared/rollup.config.mjs index a2652cf17..2c687b9cf 100644 --- a/shared/rollup.config.mjs +++ b/shared/rollup.config.mjs @@ -33,7 +33,7 @@ export function createConfig({ pkg, external = [] }) { { format: 'es', file: pkg.module, - plugins: [emitModulePackageFile(), emitDeclarationFile()], + plugins: [emitDeclarationFile('m')], sourcemap: true } ], @@ -41,26 +41,13 @@ export function createConfig({ pkg, external = [] }) { }; } -export function emitModulePackageFile() { - return { - name: 'emit-module-package-file', - generateBundle() { - this.emitFile({ - type: 'asset', - fileName: 'package.json', - source: `{"type":"module"}` - }); - } - }; -} - -export function emitDeclarationFile() { +export function emitDeclarationFile(m = '') { return { name: 'emit-declaration-file', async generateBundle() { this.emitFile({ type: 'asset', - fileName: 'index.d.ts', + fileName: `index.d.${m}ts`, source: await fs.readFile('./types/index.d.ts') }); }