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

docs: v12 migration guide [LIBS-689] #884

Open
wants to merge 28 commits into
base: alpha
Choose a base branch
from

Conversation

KaiVandivier
Copy link
Contributor

@KaiVandivier KaiVandivier commented Oct 17, 2024

LIBS-689

  • Needs some React 18 info
  • Add last bit of React 18 info after final tests
  • Some information about env vars is pending some discussion

docs/migration/v12.md Outdated Show resolved Hide resolved

- Environment variables on `process.env` will be dropped in future versions, in favor of variables on `import.meta.env`
- The default `direction` config value is `ltr`; in the future, it will be `auto`
- `--allowJsxInJs` will be removed
Copy link
Contributor

Choose a reason for hiding this comment

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

wil this be removed in the underlying Vite CLI?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not sure which bullet point you mean haha, but here's an answer for each:

  1. Env vars are under our control, but I'm actually rethinking this point, i.e. maybe we should keep variables on process.env -- Earlier, I thought import.meta.env was a pretty standard thing with ES6 and that we should migrate to that for env vars, but I think that's actually just a Vite pattern, so it might be "more standard" to keep env vars on process.env. If we do that, we can at least deprecate the REACT_APP_ prefixes for the variable keys
  2. (Probably obvious, but direction is also under our control)
  3. For --allowJsxInJs, that's also under our control -- it's a flag that our own CLI reads, and adds a bunch of kinda complex Vite config in makeViteConfig.mjs. That additional config may or may not be supported in future versions of Vite, but I think we should remove our --allowJsxInJs flag and config in the next cli-app-scripts version to make things simpler, standardized, and more performant

@@ -1,6 +1,8 @@
- [**Getting Started**](getting-started.md)
- [**Installation**](installation.md)
- [**Bootstrapping**](bootstrapping.md)
- [**Migration**](migration)
Copy link
Contributor

Choose a reason for hiding this comment

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

This sidebar isn't used, you need to add it to the sidebar in the developer portal!

So after merging this PR you'd need to merge the developer portal PR as well to get it to show up.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah okay, thanks for the reminder!

@KaiVandivier KaiVandivier requested a review from a team October 30, 2024 09:30
@Topener Topener self-requested a review October 30, 2024 10:20
Copy link
Contributor

@Topener Topener left a comment

Choose a reason for hiding this comment

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

First of all, amazing guide. It looks very detailed and exhaustive.

I went through the guide with a very nit-picky and oblivious point-of-view, so I added a grand total of 21 comments and suggestions to make it easier to read and contextually make sense.

docs/migration/v12.md Outdated Show resolved Hide resolved
@@ -0,0 +1,329 @@
# Platform v12 migration guide: Vite & React 18

Good news! Vite and React 18 in the app platform are ready to use!
Copy link
Contributor

Choose a reason for hiding this comment

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

This line, while good and happy, is very much "timed" as if for a blogpost or the announcement. If someone reads this guide in half a year or later it will be odd. Not sure if it can be omitted fully or reworded.

Paragraph below could use a little rewording as well to match this sentiment.

docs/migration/v12.md Outdated Show resolved Hide resolved
docs/migration/v12.md Outdated Show resolved Hide resolved
docs/migration/v12.md Outdated Show resolved Hide resolved

Here are some edge cases that were encountered when upgrading some apps with the new platform version:

- There is a bug in Vite: importing from a directory, e.g. `‘./app/‘` where we would assume to get `./app/index.[jt]s`, can incorrectly resolve to a file with a similar name to the directory, e.g. `./App.tsx`. I see this as a bug with Vite, but as a workaround, file and dir names can be changed so they don’t conflict. Noticed in the Maintenance app beta.
Copy link
Contributor

Choose a reason for hiding this comment

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

Can the Maintenance app example be linked/explained?


- There is a bug in Vite: importing from a directory, e.g. `‘./app/‘` where we would assume to get `./app/index.[jt]s`, can incorrectly resolve to a file with a similar name to the directory, e.g. `./App.tsx`. I see this as a bug with Vite, but as a workaround, file and dir names can be changed so they don’t conflict. Noticed in the Maintenance app beta.
- If you’re using `identity-obj-proxy` in your test config, make sure you add it to the project’s dependencies. Previously, some apps got away with using the proxy without an explicitid dependency because the package is a dependency of `react-scripts`
- You may see some build warnings coming from the `mathjs` package. Upgrading to a recent version of `mathjs` will handle these warnings. Noticed in analytics app (the analytics library has a dependency on `mathjs`)
Copy link
Contributor

Choose a reason for hiding this comment

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

Does the mention of the Analytics app matter? It might confuse more than solve as the solution is a simple upgrade of a package. Maybe add the command to handle this upgrade instead?

docs/migration/v12.md Outdated Show resolved Hide resolved
docs/migration/v12.md Outdated Show resolved Hide resolved
9. An `App.jsx` entrypoint is no longer quietly added if a plugin entrypoint is defined or for a defined but empty entrypoints object
10. Plugins and apps are started together in the same process on the same port
11. Custom `index.html` files are no longer supported
12. `import * as MyClass from ‘my-module’` is now more restrictive, and may break in some cases. So far, changing the import to `import MyClass from ‘my-module’` has fixed it. DOMPurify is one example case, noticed in the Login App
Copy link
Contributor

Choose a reason for hiding this comment

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

Can Login App example be linked/explained?

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