Skip to content

Commit

Permalink
compile preace src instead of minified dist
Browse files Browse the repository at this point in the history
  • Loading branch information
johrstrom committed Jul 15, 2024
1 parent 52fd05e commit 9f49e74
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion apps/dashboard/esbuild.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,30 @@ const prepPlugin = {
},
}


const preactSrcResolvePlugin = {
name: 'preactSrcResolve',
setup(build) {
// Redirect all paths starting with "images/" to "./public/images/"
build.onResolve({ filter: /preact/ }, args => {
const basePath = `${__dirname}/node_modules/preact`;
if (args.path == 'preact') {
return { path: `${basePath}/src/index.js` }
} else if(args.path == 'preact/hooks') {
return { path: `${basePath}/hooks/src/index.js` }
}
})
},
}

esbuild.build({
entryPoints: entryPoints,
bundle: true,
sourcemap: true,
format: 'esm',
outdir: buildDir,
external: ['fs'],
plugins: [prepPlugin],
plugins: [prepPlugin, preactSrcResolvePlugin],
minify: process.env.RAILS_ENV == 'production' ? true : false,
}).catch((e) => console.error(e.message));

0 comments on commit 9f49e74

Please sign in to comment.