question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

New style Box HOCs cause hard error with ParcelJS

See original GitHub issue

Expected Behavior

Able to use ParcelJS to bundle applications using Grommet >= v2.1.1

Actual Behavior

When using ParcelJS as a bundler, Grommet v2.1.1 fails with an error.

URL, screen shot, or Codepen exhibiting the issue

Uncaught Error: Cannot find module './Box/doc'
    at newRequire (src.7ed060e2.js:39)
    at localRequire (src.7ed060e2.js:55)
    at doc (hocs.js:27)
    at Object.parcelRequire.../node_modules/grommet/es6/components/Box/Box.js.react (Box.js:20)
    at newRequire (src.7ed060e2.js:49)
    at localRequire (src.7ed060e2.js:55)
    at Object.parcelRequire.../node_modules/grommet/es6/components/Box/index.js../Box (index.js:1)
    at newRequire (src.7ed060e2.js:49)
    at localRequire (src.7ed060e2.js:55)
    at Object.parcelRequire.../node_modules/grommet/es6/components/Accordion/Accordion.js.react (Accordion.js:12)

Steps to Reproduce

  1. Use ParcelJS as bundler
  2. Include Box as a dependency
  3. Run server and attempt to access

Have verified this does not happen in v2.1.0. It seems it was likely introduced here: https://github.com/grommet/grommet/commit/4c7c0522f247f4b395732c36a1a614c94dc08f4d

Your Environment

  • Grommet version: 2.1.1
  • Browser Name and version: Chrome 71
  • Operating System and version (desktop or mobile): Desktop

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:5
  • Comments:14 (6 by maintainers)

github_iconTop GitHub Comments

4reactions
ShimiSuncommented, Mar 19, 2019

Thank you all for the collaboration and feedback. we reverted the changes that caused the issue, and Grommet & ParcelJS should work as expected on https://github.com/grommet/grommet/tarball/stable. I’ll do an official release in the next couple of days that will include the fix.

2reactions
one19commented, Mar 12, 2019

@ShimiSun that leaves a bit to be desired, honestly.

Forcing the bundling tool for an entire application to run in production mode (much slower, and without many benefits) because of a very strangely pathed documentation HOC import in a single dependency seems like the cart leading the horse.

My use case is better served by not upgrading grommet until a better solution is found.

https://github.com/parcel-bundler/parcel/issues/2719 the issue on parcel’s side seems to indicate they’ll not support this variety of import /:.

I’m at a bit of a crossroads on it. I like both parcel and grommet because of their simplicity of use. Dropping either, or degrading the operation of one for the other seems counter-productive. I’m 100% loathe to roll another webpack/babel setup when parcel solves it for most use cases.

Is there a method of running this HOC that doesn’t involve conditional imports that are dynamically named?

My question: my understanding is that the end-developer will never see these docs unless generating them, so why aren’t they enabled via a specific NODE_ENV instead of !production?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Diagnostics and Logging - Parcel
Diagnostics can include a message, information about the file being processed, a code frame, error information, hints on how to potentially resolve the...
Read more >
Parcel.js
Parcel combines a great out-of-the-box development experience with a scalable architecture that can take your project from just getting started to massive ...
Read more >
Development - Parcel
Parcel includes a development server out of the box supporting hot reloading, HTTPS, an API proxy, and more.
Read more >
Parcel 2 RC
Modern browsers support <script type="module"> , which in addition to supporting import and export syntax, also supports other modern syntax ...
Read more >
Some notes on using esbuild - Hacker News
There are new esm based cdns (similar things have been around since ... Recently I learned about esbuild which is a more Unix-style...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found