|
@@ -10,18 +10,17 @@ import babel from 'esbuild-plugin-babel'
|
|
|
const UPPY_ROOT = new URL('../', import.meta.url)
|
|
|
const PACKAGES_ROOT = new URL('./packages/', UPPY_ROOT)
|
|
|
|
|
|
-function buildBundle (srcFile, bundleFile, { minify = true, standalone = '', plugins, target } = {}) {
|
|
|
+function buildBundle (srcFile, bundleFile, { minify = true, standalone = '', plugins, target, format } = {}) {
|
|
|
return esbuild.build({
|
|
|
bundle: true,
|
|
|
sourcemap: true,
|
|
|
entryPoints: [srcFile],
|
|
|
outfile: bundleFile,
|
|
|
- banner: {
|
|
|
- js: '"use strict";',
|
|
|
- },
|
|
|
+ platform: 'browser',
|
|
|
minify,
|
|
|
plugins,
|
|
|
target,
|
|
|
+ format,
|
|
|
}).then(() => {
|
|
|
if (minify) {
|
|
|
console.info(chalk.green(`✓ Built Minified Bundle [${standalone}]:`), chalk.magenta(bundleFile))
|
|
@@ -37,12 +36,17 @@ await fs.mkdir(new URL('./@uppy/locales/dist', PACKAGES_ROOT), { recursive: true
|
|
|
|
|
|
const methods = [
|
|
|
buildBundle(
|
|
|
- './packages/uppy/bundle.js',
|
|
|
+ './packages/uppy/index.mjs',
|
|
|
+ './packages/uppy/dist/uppy.min.mjs',
|
|
|
+ { standalone: 'Uppy (ESM)', format: 'esm' },
|
|
|
+ ),
|
|
|
+ buildBundle(
|
|
|
+ './packages/uppy/bundle.mjs',
|
|
|
'./packages/uppy/dist/uppy.min.js',
|
|
|
- { standalone: 'Uppy' },
|
|
|
+ { standalone: 'Uppy', format: 'iife' },
|
|
|
),
|
|
|
buildBundle(
|
|
|
- './packages/uppy/bundle-legacy.js',
|
|
|
+ './packages/uppy/bundle-legacy.mjs',
|
|
|
'./packages/uppy/dist/uppy.legacy.min.js',
|
|
|
{
|
|
|
standalone: 'Uppy (with polyfills)',
|
|
@@ -94,7 +98,7 @@ methods.push(
|
|
|
),
|
|
|
)
|
|
|
|
|
|
-Promise.all(methods).then(() => {
|
|
|
+await Promise.all(methods).then(() => {
|
|
|
console.info(chalk.yellow('✓ JS bundles 🎉'))
|
|
|
}, (err) => {
|
|
|
console.error(chalk.red('✗ Error:'), chalk.red(err.message))
|