From d072b7189dd5fb8cf9c85cbb40100be493c3c8bb Mon Sep 17 00:00:00 2001 From: Josemar Luedke Date: Thu, 3 Feb 2022 13:29:42 -0800 Subject: [PATCH] Addon Dev - Allow ts,gts,gjs files as publicEntrypoints --- packages/addon-dev/src/rollup-app-reexports.ts | 2 +- packages/addon-dev/src/rollup-public-entrypoints.ts | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/addon-dev/src/rollup-app-reexports.ts b/packages/addon-dev/src/rollup-app-reexports.ts index 5010c191c..b0c9f7cd5 100644 --- a/packages/addon-dev/src/rollup-app-reexports.ts +++ b/packages/addon-dev/src/rollup-app-reexports.ts @@ -13,7 +13,7 @@ export default function appReexports(opts: { let pkg = readJsonSync('package.json'); let appJS: Record = {}; for (let filename of Object.keys(bundle)) { - if (opts.include.some((glob) => minimatch(filename, glob))) { + if (opts.include.some((glob) => minimatch(filename, glob)) && !minimatch(filename, '**/*.d.ts')) { appJS[`./${filename}`] = `./dist/_app_/${filename}`; this.emitFile({ type: 'asset', diff --git a/packages/addon-dev/src/rollup-public-entrypoints.ts b/packages/addon-dev/src/rollup-public-entrypoints.ts index d7afb2236..c7759cb55 100644 --- a/packages/addon-dev/src/rollup-public-entrypoints.ts +++ b/packages/addon-dev/src/rollup-public-entrypoints.ts @@ -2,6 +2,10 @@ import walkSync from 'walk-sync'; import type { Plugin } from 'rollup'; import { join } from 'path'; +function normalizeFileExt(fileName: string) { + return fileName.replace(/\.ts|\.gts|\.gjs$/, '.js') +} + export default function publicEntrypoints(args: { srcDir: string; include: string[]; @@ -15,7 +19,7 @@ export default function publicEntrypoints(args: { this.emitFile({ type: 'chunk', id: join(args.srcDir, name), - fileName: name, + fileName: normalizeFileExt(name), }); } },