diff --git a/packages/addon-dev/src/rollup-addon-dependencies.ts b/packages/addon-dev/src/rollup-addon-dependencies.ts index 0f0172fdc..6fac8c628 100644 --- a/packages/addon-dev/src/rollup-addon-dependencies.ts +++ b/packages/addon-dev/src/rollup-addon-dependencies.ts @@ -11,8 +11,8 @@ const compilationModules = new Set( templateCompilationModules.map((m) => m.module) ); -function resolvableDependencies() { - let deps = new Set(); +function resolvableDependencies(): Set { + let deps = new Set(); let pkg = readJsonSync('package.json'); if (pkg.dependencies) { for (let name of Object.keys(pkg.dependencies)) { @@ -28,11 +28,16 @@ function resolvableDependencies() { } export default function emberExternals(): Plugin { - let deps = resolvableDependencies(); + let deps: Set; return { name: 'ember-externals', + buildStart() { + this.addWatchFile('package.json'); + deps = resolvableDependencies(); + }, + async resolveId(source) { let pkgName = packageName(source); if (!pkgName) { diff --git a/packages/addon-dev/src/rollup-keep-assets.ts b/packages/addon-dev/src/rollup-keep-assets.ts index 40de57188..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) { diff --git a/packages/addon-dev/src/rollup-public-assets.ts b/packages/addon-dev/src/rollup-public-assets.ts index 80147ead8..156018524 100644 --- a/packages/addon-dev/src/rollup-public-assets.ts +++ b/packages/addon-dev/src/rollup-public-assets.ts @@ -11,6 +11,13 @@ export default function publicAssets( return { name: 'public-assets-bundler', + + // Prior to https://github.com/rollup/rollup/pull/5270, we cannot call this + // from within `generateBundle` + buildStart() { + this.addWatchFile(path); + }, + generateBundle() { let pkg = readJsonSync('package.json'); const filenames = walkSync(path, { diff --git a/packages/addon-dev/src/rollup-public-entrypoints.ts b/packages/addon-dev/src/rollup-public-entrypoints.ts index af7dcb5f9..29cc2a560 100644 --- a/packages/addon-dev/src/rollup-public-entrypoints.ts +++ b/packages/addon-dev/src/rollup-public-entrypoints.ts @@ -15,6 +15,8 @@ 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'], });