Skip to content

Commit

Permalink
fix(dynamic cdn): handle package without varName (#3916)
Browse files Browse the repository at this point in the history
  • Loading branch information
jmfrancois committed Apr 25, 2022
1 parent 7373fd3 commit 28df3ee
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/three-cups-taste.md
@@ -0,0 +1,5 @@
---
'@talend/dynamic-cdn-webpack-plugin': patch
---

fix: handle package without varName
8 changes: 5 additions & 3 deletions fork/dynamic-cdn-webpack-plugin/src/index.js
Expand Up @@ -276,7 +276,9 @@ class DynamicCdnWebpackPlugin {

async addModule(contextPath, modulePath, { env, isOptional = false }) {
const isModuleExcluded =
this.exclude.includes(modulePath) || (this.only && !this.only.includes(modulePath));
this.exclude.includes(modulePath) ||
(this.only && !this.only.includes(modulePath)) ||
modulePath.startsWith('@types/');
if (isModuleExcluded) {
return false;
}
Expand Down Expand Up @@ -316,7 +318,7 @@ class DynamicCdnWebpackPlugin {
if (!this.directDependencies[modulePath]) {
this.directDependencies[modulePath] = this.modulesFromCdn[modulePath];
}
return this.modulesFromCdn[modulePath].var;
return this.modulesFromCdn[modulePath].var || true;
}

this.log(
Expand Down Expand Up @@ -401,7 +403,7 @@ class DynamicCdnWebpackPlugin {
this.modulesFromCdn[modulePath] = cdnConfig;
this.directDependencies[modulePath] = cdnConfig;
this.debug('\n✅', modulePath, version, `will be served by ${cdnConfig.url}`);
return cdnConfig.var;
return cdnConfig.var || true;
}

applyWebpackCore(compiler) {
Expand Down

0 comments on commit 28df3ee

Please sign in to comment.