aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/to-javascript.js15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/to-javascript.js b/src/to-javascript.js
index 0acf180..b402ad4 100644
--- a/src/to-javascript.js
+++ b/src/to-javascript.js
@@ -103,10 +103,19 @@ function makeJS(psModule, psModuleMap, js) {
103 } 103 }
104 104
105 const additionalImportsResult = additionalImports.map(import_ => { 105 const additionalImportsResult = additionalImports.map(import_ => {
106 const escapedPath = jsStringEscape(psModuleMap[import_].src); 106 const moduleValue = psModuleMap[import_];
107 107
108 return `var ${import_.replace(/\./g, '_')} = require("${escapedPath}")`; 108 if (!moduleValue) {
109 }).join('\n'); 109 debug('module %s was not found in the map, skipping require', import_);
110
111 return null;
112 }
113 else {
114 const escapedPath = jsStringEscape(moduleValue.src);
115
116 return `var ${import_.replace(/\./g, '_')} = require("${escapedPath}")`;
117 }
118 }).filter(a => a !== null).join('\n');
110 119
111 const result_ = result + (additionalImports.length ? '\n' + additionalImportsResult : ''); 120 const result_ = result + (additionalImports.length ? '\n' + additionalImportsResult : '');
112 121