Skip to content

Commit

Permalink
fix: run esbuild with plugins on all project files
Browse files Browse the repository at this point in the history
Not just the named ones.
  • Loading branch information
wkillerud committed Oct 6, 2023
1 parent 90578ae commit 6295bd1
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions api/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,11 +147,16 @@ export async function build({ state, config, cwd = process.cwd() }) {
setup(buildInstance) {
buildInstance.onResolve(
{
filter: /(content|fallback|lazy|scripts|src).*.(ts|js)$/,
filter: /(content|fallback|lazy|scripts|src|server).*.(ts|js)$/,
namespace: 'file',
},
async (args) => {
if (args.path.includes('node_modules')) return;
if (
args.path.includes('node_modules') ||
args.resolveDir.includes('node_modules')
) {
return;
}

let file = args.path;
if (!isAbsolute(args.path)) {
Expand All @@ -167,10 +172,8 @@ export async function build({ state, config, cwd = process.cwd() }) {
outfile = LAZY_INTERMEDIATE;
} else if (file === SCRIPTS_ENTRY) {
outfile = SCRIPTS_INTERMEDIATE;
}

if (!outfile) {
return;
} else {
outfile = join(ESBUILD_OUTDIR, file.replace(cwd, ''));
}

await esbuild.build({
Expand Down

0 comments on commit 6295bd1

Please sign in to comment.