How to use the esbuild.serve function in esbuild

To help you get started, we’ve selected a few esbuild examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github cs8425 / go-bot / admin-web / web-src / esbuild-dev.js View on Github external
build.onResolve({ filter: /^react$/ }, args => {
			return {
				path: require.resolve('preact/compat'),
				external: false,
			}
		});
		build.onResolve({ filter: /^react-dom$/ }, args => {
			return {
				path: require.resolve('preact/compat'),
				external: false,
			}
		});
	},
}

esbuild.serve({
	servedir: 'public',
	port: config.internalPort,
}, {
	entryPoints: ['src/main.js'],
	bundle: true,
	sourcemap: true,
	sourcesContent: true,
	target: [
		'es2015',
	],
	outfile: 'public/js/main.js',
	loader: {
		'.js': 'jsx',
	},
	jsxFactory: 'h',
	jsxFragment: 'Fragment',

esbuild

An extremely fast JavaScript and CSS bundler and minifier.

MIT
Latest version published 1 month ago

Package Health Score

93 / 100
Full package analysis

Popular esbuild functions