Do not build esm while watching

ESM modules are only important for tree shaking - when building the
final production bundle
This commit is contained in:
Jerko Steiner 2019-11-02 13:58:55 -04:00
parent 34173f4cf6
commit 77b09fa653

View File

@ -176,7 +176,7 @@ async function buildJs(path: string) {
async function watchJs(path: string, hot = false, ...extraArgs: string[]) { async function watchJs(path: string, hot = false, ...extraArgs: string[]) {
const args = [ const args = [
join(path, 'esm', 'entrypoint.js'), join(path, 'lib', 'entrypoint.js'),
] ]
if (hot) { if (hot) {
const hotArgs = [ const hotArgs = [
@ -252,9 +252,9 @@ export async function frontend(...argv: string[]) {
if (args['full-paths']) { if (args['full-paths']) {
watchArgs.push('--full-paths') watchArgs.push('--full-paths')
} }
await build(argv[0], ...['--esm', path]) await build(argv[0], ...[path])
const promises = [ const promises = [
build(argv[0], ...['--esm', path, '--watch']), build(argv[0], ...[path, '--watch']),
watchJs(path, args.hot, ...watchArgs), watchJs(path, args.hot, ...watchArgs),
watchCss(path), watchCss(path),
] ]