smart detection for uv.client.js

People may forget to update uv.config.js or cache may need to update
This commit is contained in:
David Reed 2022-11-23 13:38:36 -05:00
parent e502dc33ea
commit 26d17cd241
No known key found for this signature in database
GPG key ID: 2211691D8A1EE72F

View file

@ -52,7 +52,12 @@ class Ultraviolet {
this.meta.origin ||= '';
this.bundleScript = options.bundle || '/uv.bundle.js';
this.handlerScript = options.handler || '/uv.handler.js';
this.clientScript = options.client || '/uv.client.js';
this.clientScript =
options.client ||
(options.bundle &&
options.bundle.includes('uv.bundle.js') &&
options.bundle.replace('uv.bundle.js', 'uv.client.js')) ||
'/uv.client.js';
this.configScript = options.config || '/uv.config.js';
this.meta.url ||= this.meta.base || '';
this.codec = Ultraviolet.codec;