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

Remove nullish coalescing operator from build to support webpack 4 #34

Closed
wants to merge 1 commit into from

Conversation

henryfauna
Copy link

Ticket(s): FE-###

Problem

Webpack 4 (used by CRA) does not support the nullish coalescing operator.

Solution

Use a babel plugin to transpile the operator at build time.

Result

A build which can be used by CRA apps.

Out of scope

N/A

Testing

Ran build and verified no instances of ??

@cleve-fauna
Copy link
Contributor

What is CRA?

@henryfauna
Copy link
Author

What is CRA?

Create React App - which bundles a bunch of stuff under react-scripts including webpack

@cleve-fauna
Copy link
Contributor

Do we want to use CRA? I believe we kind of have dependency hell due to it.

@henryfauna
Copy link
Author

henryfauna commented Jan 27, 2023

Do we want to use CRA? I believe we kind of have dependency hell due to it.

Well we are using it for the new dashboard - we can eject and do it by hand but went with that for now for expediency. Plus it's generally very widely used so good to support it. I figure others will run into this fairly quickly once it's public.

@cleve-fauna
Copy link
Contributor

Do we want to use CRA? I believe we kind of have dependency hell due to it.

Well we are using it for the new dashboard - we can eject and do it by hand but went with that for now for expediency. Plus it's generally very widely used so good to support it. I figure others will run into this fairly quickly once it's public.

  • I agree we should make this build output compatible to it
  • but I would like to see a deep dive on if we should use it for a production website (so orthogonal to this driver).
  • from the (brief) dive I did into our current website performance the default CRA settings were putting the app into one huge file and the dependency hell problems seem to stem from CRA hiding implementation
  • that being said - its probably good for prototyping; but i would like to see a well thought out case before we settle on it. Can you add a card to the post-beta for this? Please link the card here.

Copy link
Contributor

@cleve-fauna cleve-fauna left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@henryfauna instead of hacking babel let's do it the esbuild way:

https://esbuild.github.io/content-types/#javascript

@mwilde345
Copy link
Member

I agree CRA is not what we want for a final production build, and I remember some discussions about using rollup or even a new flashy build system like vite.

@henryfauna
Copy link
Author

I agree CRA is not what we want for a final production build, and I remember some discussions about using rollup or even a new flashy build system like vite.

Ooh yeah vite would be cool

@henryfauna henryfauna closed this Jan 27, 2023
@cleve-fauna cleve-fauna deleted the remove-nullish-coalescing-operator branch March 31, 2023 20:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants