Skip to content

Commit

Permalink
fix: handle empty modules in dependecies
Browse files Browse the repository at this point in the history
  • Loading branch information
xtuc committed May 4, 2018
1 parent 869a9fc commit 1bc7657
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/wasm/WasmMainTemplatePlugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@ function generateImportObject(module) {
const exportName = dep.name;
const usedName = dep.module && dep.module.isUsed(exportName);

if (dep.module === null) {
// Dependency was not found, an error will be thrown later
continue;
}

if (usedName !== false) {
array.push({
exportName,
Expand Down
5 changes: 5 additions & 0 deletions lib/wasm/WebAssemblyJavascriptGenerator.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ function generateInitParams(module) {
const exportName = dep.name;
const usedName = dep.module && dep.module.isUsed(exportName);

if (dep.module === null) {
// Dependency was not found, an error will be thrown later
continue;
}

if (usedName !== false) {
list.push(
`__webpack_require__(${JSON.stringify(
Expand Down

0 comments on commit 1bc7657

Please sign in to comment.