@zohodesk/client_build_tool 0.0.6-exp.15 → 0.0.6-exp.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -39,7 +39,7 @@ class CdnChangePlugin {
|
|
|
39
39
|
constructor(options) {
|
|
40
40
|
this.createSeparateSMap = options.createSeparateSMap;
|
|
41
41
|
this.i18nTemplate = options.i18nTemplate || '{{__I18N_CDN__}}';
|
|
42
|
-
this.variableName = options.variableName || '
|
|
42
|
+
this.variableName = options.variableName || 'window.__JS_CDN__';
|
|
43
43
|
this.cssTemplate = options.cssTemplate || '{{__CSS_CDN__}}';
|
|
44
44
|
this.jsTemplate = options.jsTemplate || '{{__JS_CDN__}}';
|
|
45
45
|
this.mode = options.mode || 'prod';
|
|
@@ -77,7 +77,7 @@ class CdnChangePlugin {
|
|
|
77
77
|
data.assets = { ...data.assets,
|
|
78
78
|
css: data.assets.css.map(css => `${this.cssTemplate}${css}`),
|
|
79
79
|
js: data.assets.js.map(js => {
|
|
80
|
-
if (((0, _modeUtils.isProductionMode)(mode) || createSeparateSMap) && !(0, _nameTemplates.isI18nFile)(js)) {
|
|
80
|
+
if (((0, _modeUtils.isProductionMode)(mode) || createSeparateSMap()) && !(0, _nameTemplates.isI18nFile)(js)) {
|
|
81
81
|
if (js.includes('smap')) {
|
|
82
82
|
js = js.replace('smap/js/', `{{--js-smap}}js/`); //eslint-disable-line
|
|
83
83
|
} else {
|
package/lib/shared/bundler/webpack/custom_plugins/CdnChangePlugin/webpackCustomJsUrlLoader.js
CHANGED
|
@@ -255,8 +255,8 @@ class CustomizedGetChunkFilenameRuntimeModule extends _webpack.RuntimeModule {
|
|
|
255
255
|
return _webpack.Template.asString([`// This function allow to reference ${includedChunksMessages.join(' and ')}`, `${global} = ${runtimeTemplate.basicFunction('chunkId', staticUrls.size > 0 ? ['// return url for filenames not based on template', // it minimizes to `x===1?"...":x===2?"...":"..."`
|
|
256
256
|
_webpack.Template.asString(Array.from(staticUrls, ([url, ids]) => {
|
|
257
257
|
const condition = ids.size === 1 ? `chunkId === ${JSON.stringify(first(ids))}` : `{${Array.from(ids, id => `${JSON.stringify(id)}:1`).join(',')}}[chunkId]`;
|
|
258
|
-
return `if (${condition}) return
|
|
259
|
-
})), '// return url for filenames based on template', `return
|
|
258
|
+
return `if (${condition}) return ${this.variableName}+${url};`;
|
|
259
|
+
})), '// return url for filenames based on template', `return ${this.variableName}+${url};`] : ['// return url for filenames based on template', `return ${this.variableName}+${url};`])};`]);
|
|
260
260
|
}
|
|
261
261
|
|
|
262
262
|
}
|
|
@@ -51,7 +51,7 @@ class SourceMapPlugin {
|
|
|
51
51
|
|
|
52
52
|
}, assets => {
|
|
53
53
|
Object.keys(assets).forEach(assetName => {
|
|
54
|
-
if (assetName.includes('runtime') && skipRuntimeFiles) {
|
|
54
|
+
if (assetName.includes('runtime') && skipRuntimeFiles(assetName)) {
|
|
55
55
|
const runtimeAssetCode = assets[assetName].source();
|
|
56
56
|
const newAssetName = `smap/${assetName}`;
|
|
57
57
|
compilation.emitAsset(newAssetName, new RawSource(runtimeAssetCode));
|