Skip to content

Instantly share code, notes, and snippets.

@davidfirst
Created September 18, 2018 18:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save davidfirst/f2f7110874e50bbb10f3f8f3f7eb9454 to your computer and use it in GitHub Desktop.
Save davidfirst/f2f7110874e50bbb10f3f8f3f7eb9454 to your computer and use it in GitHub Desktop.
patch-import-path-error
diff --git a/src/links/link-generator.js b/src/links/link-generator.js
index 62123823..3eaa3019 100644
--- a/src/links/link-generator.js
+++ b/src/links/link-generator.js
@@ -348,7 +348,7 @@ The dependencies array has the following ids: ${dependencies.map(d => d.id).join
return R.flatten(currLinks);
});
const internalCustomResolvedLinks = parentComponent.customResolvedPaths.length
- ? getInternalCustomResolvedLinks(parentComponent, createNpmLinkFiles)
+ ? getInternalCustomResolvedLinks(parentComponent, parentComponentMap, createNpmLinkFiles)
: [];
const flattenLinks = R.flatten(links).concat(internalCustomResolvedLinks);
@@ -426,8 +426,8 @@ The dependencies array has the following ids: ${dependencies.map(d => d.id).join
* components/utils/jump/utils/is-string.js
* components/utils/jump/node_modules/utils/is-string // this is the file we generate here
*/
-function getInternalCustomResolvedLinks(component: Component, createNpmLinkFiles: boolean): LinkFile[] {
- const componentDir = component.writtenPath;
+function getInternalCustomResolvedLinks(component: Component, componentMap, createNpmLinkFiles: boolean): LinkFile[] {
+ const componentDir = component.writtenPath || componentMap.rootDir;
const getDestination = (importSource: string) => `node_modules/${importSource}`;
return component.customResolvedPaths.map((customPath) => {
const sourceAbs = path.join(componentDir, customPath.destinationPath);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment