[DEVEX] Build process logs multiple console warnings when building Venia ES Modules #880
Closed
1 of 6 tasks
Labels
bug
Something isn't working
Describe the bug
Since adding babel-plugin-module-resolver in #788, and a Babel compilation step which creates consumable ES Modules for third party projects, we've had a lot of noise in the Babel build output saying
Could not resolve '@magento/venia-drivers' in <path>
.We put in a warning that these messages are normal and no problem, but it often scrolls by too fast to read--and it happens in dev mode too!
The cause is that we configure the plugin to rewrite calls to the real file
/src/drivers
to an alias@venia-concept/drivers
. The@magento/venia-drivers
file doesn't really exist. When building Venia, we map it back to the real file here, using this specification, but the idea is that third-party consumers using Venia modules should make their own alias to a replacement file.However,
babel-plugin-module-resolver
doesn't expect this kind of "partial resolution" that happens in two steps, so in development mode it throws warnings when it can't locate the file it's mapping to.Unfortunately, this behavior is not easily configurable because it relies on a global environment variable, which we don't want to set to
production
during the ESM build because that has other side effects. (We have a pull request open to resolve this issue, but the maintainer @tleunen has not yet triaged it as of 2019/02/10).To Reproduce
Steps to reproduce the behavior:
release/2.0
.yarn && yarn build
.Expected behavior
Build output is not full of anxious warnings about missing modules.
Screenshots
Please complete the following device information:
Please let us know what packages this bug is in regards to:
venia-concept
pwa-buildpack
peregrine
pwa-devdocs
upward-js
upward-spec
(Change is in the Venia-relevant portion of root
babel-config.js
.Additional context
At some point,
babel-plugin-module-resolver
may not be the right choice here, as it's not designed for this.Possible solutions
The text was updated successfully, but these errors were encountered: