Skip to content

Commit 5ba84a1

Browse files
committed
fix(core): add a workaround to handle a bug in node 12
1 parent b70be18 commit 5ba84a1

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

packages/tao/src/commands/migrate.ts

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -630,9 +630,20 @@ async function runNxMigration(root: string, packageName: string, name: string) {
630630
const collection = JSON.parse(fs.readFileSync(collectionPath).toString());
631631
const g = collection.generators || collection.schematics;
632632
const implRelativePath = g[name].implementation || g[name].factory;
633-
const implPath = require.resolve(implRelativePath, {
634-
paths: [dirname(collectionPath)],
635-
});
633+
634+
let implPath;
635+
636+
try {
637+
implPath = require.resolve(implRelativePath, {
638+
paths: [dirname(collectionPath)],
639+
});
640+
} catch (e) {
641+
// workaround for a bug in node 12
642+
implPath = require.resolve(
643+
dirname(collectionPath) + '/' + implRelativePath
644+
);
645+
}
646+
636647
const fn = require(implPath).default;
637648
const host = new FsTree(root, false);
638649
await fn(host, {});

0 commit comments

Comments
 (0)