Skip to content

Commit

Permalink
Addon Dev - Allow ts,gts,gjs files as publicEntrypoints
Browse files Browse the repository at this point in the history
  • Loading branch information
josemarluedke committed Feb 3, 2022
1 parent 7eba4a9 commit 352567a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
5 changes: 4 additions & 1 deletion packages/addon-dev/src/rollup-app-reexports.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ export default function appReexports(opts: {
let pkg = readJsonSync('package.json');
let appJS: Record<string, string> = {};
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',
Expand Down
6 changes: 5 additions & 1 deletion packages/addon-dev/src/rollup-public-entrypoints.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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[];
Expand All @@ -15,7 +19,7 @@ export default function publicEntrypoints(args: {
this.emitFile({
type: 'chunk',
id: join(args.srcDir, name),
fileName: name,
fileName: normalizeFileExt(name),
});
}
},
Expand Down

0 comments on commit 352567a

Please sign in to comment.