-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbundle.js
More file actions
34 lines (27 loc) · 828 Bytes
/
bundle.js
File metadata and controls
34 lines (27 loc) · 828 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/usr/bin/env node
const esbuild = require('esbuild');
const path = require('path');
async function bundleCarbonCalculator() {
try {
console.log('📦 Bundling CarbonCalculator.js with dependencies...');
await esbuild.build({
entryPoints: [path.join(__dirname, 'src/core/CarbonCalculator.js')],
bundle: true,
format: 'esm',
outfile: path.join(__dirname, 'src/core/CarbonCalculator.bundle.js'),
platform: 'browser',
target: 'es2020',
external: [],
minify: false,
sourcemap: false,
});
console.log('✅ CarbonCalculator.js bundled successfully');
} catch (error) {
console.error('❌ Bundling failed:', error);
process.exit(1);
}
}
if (require.main === module) {
bundleCarbonCalculator();
}
module.exports = { bundleCarbonCalculator };