theatre/packages/dataverse/devEnv/build.ts

34 lines
797 B
TypeScript
Raw Permalink Normal View History

import * as path from 'path'
import {build} from 'esbuild'
const definedGlobals = {}
function createBundles(watch: boolean) {
const pathToPackage = path.join(__dirname, '../')
const esbuildConfig: Parameters<typeof build>[0] = {
entryPoints: [path.join(pathToPackage, 'src/index.ts')],
bundle: true,
sourcemap: true,
define: definedGlobals,
watch,
platform: 'neutral',
mainFields: ['browser', 'module', 'main'],
target: ['firefox57', 'chrome58'],
conditions: ['browser', 'node'],
}
2023-08-03 10:46:36 +02:00
void build({
...esbuildConfig,
outfile: path.join(pathToPackage, 'dist/index.js'),
format: 'cjs',
})
// build({
// ...esbuildConfig,
// outfile: path.join(pathToPackage, 'dist/index.mjs'),
// format: 'esm',
// })
}
createBundles(false)