2022-09-16 11:30:50 +00:00
|
|
|
/* eslint-disable */
|
|
|
|
|
import { readFileSync } from 'fs';
|
2023-01-23 09:30:38 +00:00
|
|
|
import { dirname, join } from 'path';
|
|
|
|
|
import { fileURLToPath } from 'url';
|
|
|
|
|
import { build as tsup } from 'tsup';
|
2022-09-16 11:30:50 +00:00
|
|
|
|
|
|
|
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
|
|
|
const pkg = JSON.parse(readFileSync(join(__dirname, 'package.json'), 'utf8'));
|
|
|
|
|
|
|
|
|
|
await tsup({
|
2022-11-22 16:58:48 +00:00
|
|
|
entry: [join(__dirname, 'example.mjs')],
|
2022-09-16 11:30:50 +00:00
|
|
|
outDir: join(__dirname, 'dist'),
|
2025-11-16 09:38:27 +00:00
|
|
|
target: 'node22',
|
2022-09-16 11:30:50 +00:00
|
|
|
format: ['esm'],
|
|
|
|
|
splitting: false,
|
|
|
|
|
sourcemap: true,
|
2022-11-22 16:58:48 +00:00
|
|
|
shims: false,
|
2022-09-16 11:30:50 +00:00
|
|
|
skipNodeModulesBundle: false,
|
|
|
|
|
noExternal: Object.keys(pkg.peerDependencies).concat(Object.keys(pkg.devDependencies)),
|
|
|
|
|
banner: {
|
|
|
|
|
js: `
|
|
|
|
|
// Adds missing require function (reason: node_modules are not transpiled)
|
|
|
|
|
import { createRequire as _createRequire } from 'module';
|
2025-11-16 09:38:27 +00:00
|
|
|
const require = _createRequire(import.meta.url);
|
2022-09-16 11:30:50 +00:00
|
|
|
`,
|
|
|
|
|
},
|
|
|
|
|
});
|