Open bluelovers opened 3 months ago
#!/usr/bin/env node import { build } from 'esbuild' import { join } from 'path' import { copy } from 'esbuild-plugin-copy'; import { main as outfile_main } from './package.json'; import { sassPlugin } from 'esbuild-sass-plugin' import { __ROOT, __ROOT_OUTPUT } from './test/__root'; (async () => { console.log(`build`, __ROOT_OUTPUT) console.log(`outfile`, outfile_main) await build({ entryPoints: [ join(__ROOT, 'src/index.mts') ], outfile: join(__ROOT_OUTPUT, 'javascript', outfile_main), bundle: true, plugins: [ sassPlugin({ type: "css-text", }), copy({ assets: [ { from: [ './scripts/**/*' ], to: [ './output/scripts' ], }, { from: [ './README\.md', 'LICENSE', ], to: [ './output' ], }, { from: [ './\.github', ], to: [ './output/.github' ], }, ], verbose: true, resolveFrom: __ROOT, }), ], platform: 'browser', treeShaking: true, sourcemap: true, // @ts-ignore //analyze: true, legalComments: 'none', allowOverwrite: true, minifySyntax: true, format: 'iife', minify: Boolean(process.env['ESBUILD_MINIFY']) }) })();