Skip to content

Commit 3a618d6

Browse files
committed
Restore allowing fallback require from working directory
1 parent 57a7633 commit 3a618d6

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

src/ember-app.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -136,8 +136,12 @@ class EmberApp {
136136
let isWhitelisted = whitelist.indexOf(packageName) > -1;
137137

138138
if (isWhitelisted) {
139-
let resolvedModulePath = resolve.sync(moduleName, { basedir: distPath });
140-
return require(resolvedModulePath);
139+
try {
140+
let resolvedModulePath = resolve.sync(moduleName, { basedir: distPath });
141+
return require(resolvedModulePath);
142+
} catch (error) {
143+
return require(moduleName);
144+
}
141145
}
142146

143147
if (isLegacyWhitelist) {
@@ -147,7 +151,6 @@ class EmberApp {
147151
if (fs.existsSync(nodeModulesPath)) {
148152
return require(nodeModulesPath);
149153
} else {
150-
// If it's not on disk, assume it's a built-in node package
151154
return require(moduleName);
152155
}
153156
} else {
@@ -390,7 +393,6 @@ class EmberApp {
390393
// set schema version to 1 if not defined
391394
schemaVersion = schemaVersion || FastBootSchemaVersions.base;
392395
debug('Current schemaVersion from `ember-cli-fastboot` is %s while latest schema version is %s', schemaVersion, currentSchemaVersion);
393-
394396
if (schemaVersion > currentSchemaVersion) {
395397
let errorMsg = chalk.bold.red('An incompatible version between `ember-cli-fastboot` and `fastboot` was found. Please update the version of fastboot library that is compatible with ember-cli-fastboot.');
396398
throw new Error(errorMsg);

0 commit comments

Comments
 (0)