-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow references to files outside js/ and css/ dirs (#26)
Stop marking the directories aside from js/ and css/ as "external" for esbuild. This allows the files inside those other directories to be referenced from within JS/CSS files and properly bundled by esbuild. Use an `onLoad` esbuild plugin callback to track referenced files so that we can exclude them from separate handling when we copy over the non-referenced asset files. Specific changes: - Stop marking any directories as external (in `esbuild.js`) - Move `findExternalDirectories` from `esbuild.js` to `esbuild-plugin.js` as `extraAssetDirs` (a more appropriate name now that nothing is marked as external), and call this directly when determining which directories we should manually copy via `processAssetDirectory`. - Introduce an `onLoad` callback to `esbuild-plugin.js` and use this to track any files that esbuild itself loads. - Use this to skip already-loaded files inside `processAssetDirectory`, which means there will be no double-processing of the files that are referenced from JS/CSS. - Then when handling esbuild's outputs (i.e. all the loaded files) to include in the manifest, make sure to use the output's original input filename for the manifest key, to avoid collisions and to keep those manifest keys consistent with non-loaded files that are copied across as part of `processAssetDirectory`. - Plus a range of other refactors/tidyings Fixes #24. Co-authored-by: mrimp <krzysiekkamilpiotrek@gmail.com>
- Loading branch information
Showing
5 changed files
with
317 additions
and
254 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.