Use Reify to compile dynamic import(...).

This commit is contained in:
Ben Newman
2019-05-15 19:12:09 -04:00
parent 7185137ce7
commit 28d74dcc9f
2 changed files with 8 additions and 1 deletions

View File

@@ -66,7 +66,9 @@ function stripHashBang(dataString) {
}
const reifyCompileWithCache = wrap(function ({ dataString }) {
return reifyCompile(stripHashBang(dataString)).code;
return reifyCompile(stripHashBang(dataString), {
dynamicImport: true,
}).code;
}, {
makeCacheKey({ hash }) {
return hash;

View File

@@ -18,3 +18,8 @@ Mp.load = function (filename) {
}
return result;
};
const resolved = Promise.resolve();
Mp.dynamicImport = function (id) {
return resolved.then(() => require(id));
};