Skip to content

Commit

Permalink
chore: handle --ext edge case
Browse files Browse the repository at this point in the history
  • Loading branch information
Caele committed Aug 10, 2021
1 parent 6072d5f commit 0e46fef
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion commands/sense/lib/build.js
Expand Up @@ -49,7 +49,7 @@ async function build(argv) {
encoding: 'utf8',
});
qextjs = qextjs.replace('{{DIST}}', `./${main.replace(/^[./]*/, '').replace(/\.js$/, '')}`);
qextjs = qextjs.replace('{{EXT}}', `./${targetDir}/${targetFile}`);
qextjs = qextjs.replace('{{EXT}}', `./${targetFile}`);

fs.writeFileSync(qextFileName, JSON.stringify(contents, null, 2));
fs.writeFileSync(qextFileNameJs, qextjs);
Expand Down
8 changes: 7 additions & 1 deletion commands/sense/src/ext.js
@@ -1,6 +1,12 @@
define(['{{DIST}}', '{{EXT}}'], (supernova, ext) =>
function supernovaExtension(env) {
var v = supernova(env);
v.ext = typeof ext === 'function' ? ext(env) : ext;
var extDef = ext;
/* eslint no-underscore-dangle:0 */
if (ext.__esmodule === true) {
// Handles es modules with multiple exports
extDef = ext.default;
}
v.ext = typeof extDef === 'function' ? extDef(env) : extDef;
return v;
});

0 comments on commit 0e46fef

Please sign in to comment.