Skip to content

Commit ce956c0

Browse files
committed
fix: default named import bug
There are issues when we import TS compiled JS files into JS because TS compiles default exports to `default` named import/export which makes it not possible to import inside JS directly. Some of the ways to fix this is using .default in all calls or avoid using default export/import totally. Ref: https://basarat.gitbooks.io/typescript/docs/tips/defaultIsBad.html
1 parent 971b31a commit ce956c0

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

bin/prompt-command.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,9 @@ module.exports = function promptForInstallation(packages, ...args) {
8585
packages
8686
);
8787
if (packages === "serve") {
88-
return require(pathForCmd).serve();
88+
return require(pathForCmd).default.serve();
8989
}
90-
return require(pathForCmd)(...args); //eslint-disable-line
90+
return require(pathForCmd).default(...args); //eslint-disable-line
9191
})
9292
.catch(error => {
9393
console.error(error);
@@ -105,6 +105,6 @@ module.exports = function promptForInstallation(packages, ...args) {
105105
}
106106
});
107107
} else {
108-
require(pathForCmd)(...args); // eslint-disable-line
108+
require(pathForCmd).default(...args); // eslint-disable-line
109109
}
110110
};

packages/utils/modify-config-helper.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import * as fs from "fs";
33
import * as logSymbols from "log-symbols";
44
import * as path from "path";
55
import * as yeoman from "yeoman-environment";
6-
import Generator from "yeoman-generator";
6+
import Generator = require("yeoman-generator");
77

88
import runTransform from "./scaffold";
99
import { IGenerator, IYeoman } from "./types/Yeoman";

0 commit comments

Comments
 (0)