diff --git a/packages/addon-dev/src/rollup-keep-assets.ts b/packages/addon-dev/src/rollup-keep-assets.ts index a8f213d30..fba42a421 100644 --- a/packages/addon-dev/src/rollup-keep-assets.ts +++ b/packages/addon-dev/src/rollup-keep-assets.ts @@ -14,6 +14,12 @@ export default function keepAssets({ return { name: 'copy-assets', + // Prior to https://github.com/rollup/rollup/pull/5270, we cannot call this + // from within `generateBundle` + buildStart() { + this.addWatchFile(from); + }, + // imports of assets should be left alone in the source code. This can cover // the case of .css as defined in the embroider v2 addon spec. async resolveId(source, importer, options) { @@ -38,8 +44,6 @@ export default function keepAssets({ globs: include, directories: false, })) { - this.addWatchFile(join(from, name)); - this.emitFile({ type: 'asset', fileName: name, diff --git a/packages/addon-dev/src/rollup-public-entrypoints.ts b/packages/addon-dev/src/rollup-public-entrypoints.ts index 367f270e2..e0839b13e 100644 --- a/packages/addon-dev/src/rollup-public-entrypoints.ts +++ b/packages/addon-dev/src/rollup-public-entrypoints.ts @@ -16,14 +16,14 @@ export default function publicEntrypoints(args: { return { name: 'addon-modules', async buildStart() { + this.addWatchFile(args.srcDir); + let matches = walkSync(args.srcDir, { globs: [...args.include, '**/*.hbs', '**/*.ts', '**/*.gts', '**/*.gjs'], ignore: args.exclude, }); for (let name of matches) { - this.addWatchFile(path.join(args.srcDir, name)); - // the matched file, but with the extension swapped with .js let normalizedName = normalizeFileExt(name);