mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-08 19:06:15 -08:00
42 lines
1.1 KiB
JavaScript
42 lines
1.1 KiB
JavaScript
import path from 'path';
|
|
import { glob } from 'glob';
|
|
import { Parcel } from '@parcel/core';
|
|
|
|
const basePath = 'packages/artplayer/src/i18n';
|
|
const entries = glob.sync(
|
|
path.join(basePath, '*.js'),
|
|
{
|
|
ignore: [
|
|
path.join(basePath, 'index.js'),
|
|
path.join(basePath, 'zh-cn.js'),
|
|
]
|
|
}
|
|
);
|
|
|
|
(async function build() {
|
|
const bundler = new Parcel({
|
|
entries: entries,
|
|
defaultConfig: '@parcel/config-default',
|
|
mode: 'production',
|
|
defaultTargetOptions: {
|
|
distDir: 'packages/artplayer/dist/i18n',
|
|
sourceMaps: false,
|
|
outputFormat: 'global',
|
|
isLibrary: true,
|
|
engines: {
|
|
browsers: ['last 1 Chrome version'],
|
|
},
|
|
},
|
|
env: {
|
|
NODE_ENV: 'production',
|
|
},
|
|
});
|
|
|
|
try {
|
|
const { bundleGraph, buildTime } = await bundler.run();
|
|
const bundles = bundleGraph.getBundles();
|
|
console.log(`✨ Built ${bundles.length} bundles in ${buildTime}ms`);
|
|
} catch (err) {
|
|
console.log(err.diagnostics);
|
|
}
|
|
})(); |