refactor(core): add version in worker url (#11614)

Co-authored-by: renovate <29139614+renovate@users.noreply.github.com>
This commit is contained in:
liuyi
2025-04-10 19:12:49 +08:00
committed by GitHub
parent a6ddfdd85e
commit e79e4c9e9b
9 changed files with 15 additions and 18 deletions

View File

@@ -405,10 +405,7 @@ export function createWorkerTargetConfig(
pkg: Package,
entry: string
): Omit<webpack.Configuration, 'name'> & { name: string } {
const workerName = path.basename(entry).replace(/\.([^.]+)$/, '');
if (!workerName.endsWith('.worker')) {
throw new Error('Worker name must end with `.worker.[ext]`');
}
const workerName = path.basename(entry).replace(/\.worker\.ts$/, '');
const buildConfig = getBuildConfigFromEnv(pkg);
return {
@@ -423,7 +420,7 @@ export function createWorkerTargetConfig(
[workerName]: entry,
},
output: {
filename: 'js/[name].js',
filename: `js/${workerName}-${buildConfig.appVersion}.worker.js`,
path: pkg.distPath.value,
clean: false,
globalObject: 'globalThis',