-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,28 @@ | ||
const alias = require('esbuild-plugin-alias'); | ||
// @ts-check | ||
|
||
const path = require('path'); | ||
const pkg = require('../package.json'); | ||
|
||
const cwd = process.cwd(); | ||
|
||
const entryPoints = pkg.entries.map((entry) => path.resolve(cwd, entry)); | ||
|
||
const isProduction = process.env.NODE_ENV === 'production'; | ||
|
||
module.exports = { | ||
module.exports = /** @satisfies {import('esbuild').BuildOptions} */ ({ | ||
alias: Object.fromEntries( | ||
Object.entries(pkg.browser).map(([key, value]) => [ | ||
key, | ||
path.resolve(cwd, `${value}.js`), | ||
]) | ||
), | ||
bundle: true, | ||
chunkNames: 'chunks/[name]-[hash]', | ||
entryPoints, | ||
format: 'iife', | ||
minify: isProduction, | ||
entryNames: '[name]', | ||
external: ['crypto', 'libxslt'], | ||
format: 'esm', | ||
minify: true, | ||
outdir: path.resolve(cwd, './public/js/build'), | ||
plugins: [ | ||
alias( | ||
Object.fromEntries( | ||
Object.entries(pkg.browser).map(([key, value]) => [ | ||
key, | ||
path.resolve(cwd, `${value}.js`), | ||
]) | ||
) | ||
), | ||
], | ||
sourcemap: isProduction ? false : 'inline', | ||
sourcemap: true, | ||
splitting: true, | ||
target: ['chrome89', 'edge89', 'firefox90', 'safari13'], | ||
}; | ||
}); |
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.