forked from thegreenwebfoundation/co2.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.esbuild.esm.js
27 lines (25 loc) · 1013 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
26
27
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')
const esbuildCommon = require('./.esbuild.common')
async function main() {
const results = await glob('src/**/!(*.test.js|test-constants.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({
...esbuildCommon,
entryPoints: justBrowserCompatibleFiles,
bundle: false,
minify: false,
sourcemap: false,
target: ['chrome58', 'firefox57', 'safari11', 'edge18', 'esnext'],
outdir: 'dist/esm',
outExtension: { '.js': '.js' },
format: 'esm'
})
}
main()