You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

28 lines
589 B
JavaScript

import * as esbuild from 'esbuild'
import CssModulesPlugin from 'esbuild-css-modules-plugin';
const config = {
entryPoints: ['src/index.tsx', 'src/App.module.css'],
bundle: true,
outdir: 'dist',
platform: 'browser',
format: 'esm',
external: ['fsevents'],
plugins: [
CssModulesPlugin(),
],
};
if(process.argv[2] === 'serve'){
const context = await esbuild.context(config);
const {host, port} = await context.serve({
servedir: 'dist',
host: '127.0.0.1'
});
console.log(`Listening on http://${host}:${port}/`);
}
else{
await esbuild.build(config);
}