forked from rdwz/co2.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.esbuild.esm.js
25 lines (23 loc) · 923 Bytes
/
.esbuild.esm.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
const esbuild = require('esbuild')
// tiny glob is a dependency of `esbuild-plugin-glob`.
// For this build however we need to filter out some extra files
// that are used for nodejs, but not in browsers, so we use the
// library directly instead of using `esbuild-plugin-glob` as a plugin
const glob = require('tiny-glob');
async function main() {
const results = await glob('src/**/!(*.test.js|!(*.js))')
// we remove node specific files here, with the assumption that
// the common use case is bundling into browser based web apps
const justBrowserCompatibleFiles = results.filter(filepath => !filepath.endsWith('node.js'))
esbuild.build({
entryPoints: justBrowserCompatibleFiles,
bundle: false,
minify: false,
sourcemap: false,
target: ['chrome58', 'firefox57', 'safari11', 'edge18', 'esnext'],
outdir: 'dist/esm',
outExtension: { '.js': '.js' },
format: 'esm'
})
}
main()