Skip to content
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

[DEVEX] Build process logs multiple console warnings when building Venia ES Modules #880

Closed
1 of 6 tasks
zetlen opened this issue Feb 10, 2019 · 1 comment
Closed
1 of 6 tasks
Labels
bug Something isn't working

Comments

@zetlen
Copy link
Contributor

zetlen commented Feb 10, 2019

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:

  1. Checkout and install PWA Studio on branch release/2.0.
  2. Run yarn && yarn build.

Expected behavior
Build output is not full of anxious warnings about missing modules.

Screenshots

image

Please complete the following device information:

  • Device: All
  • OS: All
  • Browser N/A
  • Version N/A
  • Magento Version N/A
  • NPM version 6.4.1
  • Node Version 10.14.2

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

  • Plugin maintainer merges PR
  • We hack the env var
@sirugh
Copy link
Contributor

sirugh commented Feb 11, 2019

3 hours ago the maintainer merged your PR to the resolver. Looks like we can take the easy way out :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

6 participants