1
Fork 0
esbuild-bundler-testing/esbuild.js
Jake Howard b55737d670
Commit something
It's a lot like webpack, but without all the bloat
2024-12-24 22:10:29 +00:00

43 lines
827 B
JavaScript

const esbuild = require("esbuild");
const {sassPlugin} = require('esbuild-sass-plugin');
const ESBUILD_CONFIG = {
entryPoints: [
'./src/index.js',
'./src/index.scss'
],
bundle: true,
outdir: "./dist",
plugins: [
sassPlugin({
embedded: true
}),
],
logLevel: 'info',
sourcemap: "external",
minify: true,
entryNames: "[dir]/[ext]/[name]"
};
async function build() {
await esbuild.build(ESBUILD_CONFIG)
}
async function watch() {
const context = await esbuild.context(ESBUILD_CONFIG)
await context.watch();
}
switch (process.argv[2]) {
case "build":
build();
break;
case "watch":
watch();
break;
default:
console.error(`Unknown command: ${process.argv[2]}`);
process.exit(1)
}