-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.js
23 lines (21 loc) · 1.07 KB
/
setup.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
const esbuild = require('esbuild');
function bundleDependency(entrypoint, outname, externals=[]) {
return esbuild.build({
entryPoints: [`./node_modules/${entrypoint}`],
bundle: true,
format: 'esm',
external: externals,
outfile: `./public/vendor/${outname}.js`,
}).catch(err => {
console.error(err);
process.exit(1);
});
}
bundleDependency('preact/src/index.js', 'preact')
bundleDependency('preact/hooks/src/index.js', 'preact-hooks', ['preact'])
bundleDependency('preact/compat/src/index.js', 'preact-compat', ['preact'])
bundleDependency('preact-jsx-runtime/jsx-runtime.js', 'preact-jsx-runtime', ['preact'])
bundleDependency('htm/src/index.mjs', 'htm')
bundleDependency('preact-custom-element/src/index.js', 'preact-custom-element', ['preact'])
bundleDependency('@mui/material/Button/index.js', 'material-ui-button', ['react', 'react-dom', 'react/jsx-runtime'])
bundleDependency('@mui/material/Slider/index.js', 'material-ui-slider', ['react', 'react-dom', 'react/jsx-runtime'])