From 760a202ae2cf7f3ce447d6c736e570e2e75308c6 Mon Sep 17 00:00:00 2001 From: vstefanovic97 Date: Wed, 26 Jun 2024 11:20:32 +0200 Subject: [PATCH 1/2] Add just the necessary files to rollup watch mode --- packages/addon-dev/src/rollup-keep-assets.ts | 8 ++------ packages/addon-dev/src/rollup-public-entrypoints.ts | 4 ++-- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/packages/addon-dev/src/rollup-keep-assets.ts b/packages/addon-dev/src/rollup-keep-assets.ts index fba42a421..a8f213d30 100644 --- a/packages/addon-dev/src/rollup-keep-assets.ts +++ b/packages/addon-dev/src/rollup-keep-assets.ts @@ -14,12 +14,6 @@ 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) { @@ -44,6 +38,8 @@ 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 e0839b13e..367f270e2 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); From c9a9be3f4e962f225aa92c4e2c55f22453b29d3d Mon Sep 17 00:00:00 2001 From: vstefanovic97 Date: Wed, 26 Jun 2024 18:24:27 +0200 Subject: [PATCH 2/2] Add rollup as a peerDep to @embroider/addon-dev --- packages/addon-dev/package.json | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/packages/addon-dev/package.json b/packages/addon-dev/package.json index 20fd8b22b..3a07504fb 100644 --- a/packages/addon-dev/package.json +++ b/packages/addon-dev/package.json @@ -25,6 +25,14 @@ "scripts": { "test": "jest" }, + "peerDependencies": { + "rollup": "^4.6.0" + }, + "peerDependenciesMeta": { + "rollup": { + "optional": true + } + }, "dependencies": { "@embroider/core": "workspace:^", "@rollup/pluginutils": "^4.1.1",