2025-07-09 13:26:51 +01:00
|
|
|
import wp from 'webpack';
|
|
|
|
import path from 'node:path'
|
|
|
|
const outputPath = path.resolve('./output/');
|
|
|
|
console.log(outputPath);
|
2025-07-21 17:01:43 +01:00
|
|
|
|
2025-07-26 13:44:32 +01:00
|
|
|
const ls = [
|
|
|
|
'classnames',
|
|
|
|
'semver',
|
|
|
|
'ansi-styles',
|
|
|
|
'debug',
|
|
|
|
'supports-color',
|
|
|
|
'chalk',
|
|
|
|
'ms',
|
|
|
|
'minimatch',
|
|
|
|
'strip-ansi',
|
|
|
|
'tslib',
|
|
|
|
'has-flag',
|
|
|
|
'ansi-regex',
|
|
|
|
'color-convert',
|
|
|
|
'color-name',
|
|
|
|
// 'type-fest',
|
|
|
|
'string-width'
|
|
|
|
]
|
2025-07-21 17:01:43 +01:00
|
|
|
|
2025-07-26 13:44:32 +01:00
|
|
|
ls.forEach(l=>{
|
|
|
|
|
|
|
|
const libraryLocation = import.meta.resolve(l);
|
|
|
|
console.log(libraryLocation);
|
|
|
|
// throw Error("5");
|
|
|
|
wp({
|
|
|
|
entry:libraryLocation,
|
|
|
|
mode: 'production',
|
|
|
|
optimization:{
|
|
|
|
mangleExports: false,
|
|
|
|
avoidEntryIife: true,
|
|
|
|
minimize: false
|
|
|
|
|
|
|
|
},
|
|
|
|
output: {
|
|
|
|
path: outputPath,
|
|
|
|
filename: l+'.bundle.cjs',
|
|
|
|
clean: false,
|
|
|
|
iife: false,
|
|
|
|
library: {
|
|
|
|
type: 'commonjs2',
|
|
|
|
// name: l
|
|
|
|
}
|
|
|
|
// module: true
|
|
|
|
}
|
|
|
|
,
|
|
|
|
},(err,stats)=>{
|
|
|
|
if (err || stats.hasErrors()) {
|
|
|
|
console.log(err?.stack)
|
|
|
|
console.log(stats?.hasErrors())
|
|
|
|
console.log(stats?.toJson());
|
2025-07-21 17:01:43 +01:00
|
|
|
}
|
2025-07-26 13:44:32 +01:00
|
|
|
})
|
|
|
|
|
|
|
|
|
2025-07-09 13:26:51 +01:00
|
|
|
})
|