-
-
Notifications
You must be signed in to change notification settings - Fork 215
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implemented more robust module loading (#211)
- added loadModule() utility function - updated loaders to use new module loading mechanism - added more entries to gitignore file - refactored gitignore to be more explicit
- Loading branch information
1 parent
56257f3
commit 3fc6c44
Showing
5 changed files
with
50 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
/node_modules | ||
dist | ||
coverage | ||
/**/dist/ | ||
/.idea/ | ||
/coverage/ | ||
/node_modules/ | ||
/package-lock.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import importCwd from 'import-cwd' | ||
|
||
export function loadModule(moduleId) { | ||
// Trying to load module normally (relative to plugin directory) | ||
const path = require.resolve(moduleId) | ||
if (path) { | ||
return require(path) | ||
} | ||
|
||
// Then, trying to load it relative to CWD | ||
return importCwd.silent(moduleId) | ||
} |