-
Notifications
You must be signed in to change notification settings - Fork 348
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(build): use correct path for relative imports of external modules + bracket notation #2974
fix(build): use correct path for relative imports of external modules + bracket notation #2974
Conversation
|
moduleMapProp = relative(baseDir, importedModuleName).split('\\').join('/'); | ||
importPath = `./${relative(artifactsDir, importedModuleName).split('\\').join('/')}`; | ||
moduleMapProp = relative(baseDir, importPath).split('\\').join('/'); | ||
importPath = `./${relative(artifactsDir, importPath).split('\\').join('/')}`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sample:
// prior to if block
const baseDir = 'apps/api/mesh'
const importedModuleName = './composers'
const importPath= 'apps/api/mesh/composers'
// after if block
const moduleMapProp = 'composers'
const importPath= './../composers'
@ardatan Sry for the flood of PRs, we have been migrating to mesh build (using mesh inside a sub directory in an nx project) and we have been running into these as the migration progresses. |
…ode inside typescript project
39e5048
to
7ef75ea
Compare
faf42fd
to
a1c915a
Compare
c3c0b9e
to
696f9c7
Compare
Thanks for the PR! |
Description
Rolled up two issues as they both only required minor fixes:
Issue 1
Currently using build with external modules that are specified by relative path only work when the
--dir
equals root of the workspace. Any relative import is always expressed in relation to the root workspace directory instead of in relation to thebaseDir
.Issue 2
When using a built mesh with additional resolvers from within a typescript project the compiler was complaining about either missing
.resolvers
or.default
. This was easily mitigated by using bracket notation.Type of change
Checklist:
Further comments
I have tested this locally as we were trying to get mesh build up and running in the context of an nx workspace.
Let me know if I should create a change set or wait for #2970 to create a single PR + changeset.