Skip to content

Commit

Permalink
Merge pull request #2007 from vstefanovic97/watch-only-necessary-files
Browse files Browse the repository at this point in the history
Add just the necessary files to rollup watch mode
  • Loading branch information
mansona committed Jun 27, 2024
2 parents e84b82c + c9a9be3 commit 9c22cab
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
8 changes: 8 additions & 0 deletions packages/addon-dev/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
8 changes: 2 additions & 6 deletions packages/addon-dev/src/rollup-keep-assets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -44,6 +38,8 @@ export default function keepAssets({
globs: include,
directories: false,
})) {
this.addWatchFile(join(from, name));

this.emitFile({
type: 'asset',
fileName: name,
Expand Down
4 changes: 2 additions & 2 deletions packages/addon-dev/src/rollup-public-entrypoints.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit 9c22cab

Please sign in to comment.