Skip to content

Use react-app-rewired and react-app-rewire-alias for DevX#954

Draft
rholinshead wants to merge 2 commits intomainfrom
pr954
Draft

Use react-app-rewired and react-app-rewire-alias for DevX#954
rholinshead wants to merge 2 commits intomainfrom
pr954

Conversation

@rholinshead
Copy link
Member

@rholinshead rholinshead commented Jan 18, 2024

Use react-app-rewired and react-app-rewire-alias for DevX

Use react-app-rewired and react-app-rewire-alias for DevX

The first step in fixing the DevX for the new packaging structure is to get HMR working to ensure changes to code get reflected in the browser during development. This PR leverages react-app-rewired and react-app-rewire-alias to allow us to:

  1. Override the default configurations set in place by the react-scripts setup we're using (mainly, webpack configuration)
  2. Specify aliases for paths, which enables us to link to our local aiconfig-editor package code instead of the node modules package

Unfortunately, 2. only applies to the react code itself right now, NOT type declarations. So, you can do something like remove/change existing components in jsx, but changing their props will not be reflected in HMR...

Next PR should fix that


Stack created with Sapling. Best reviewed with ReviewStack.

Ryan Holinshead added 2 commits January 26, 2024 09:54
# [editor][wip] Packaging AIConfigEditor Component with Vite

This PR separates our current editor implementation into a root package containing the LocalEditor and a library package containing the AIConfigEditor and its associated code. When we want to publish the `@lastmileai/aiconfig-editor` package, just cd into the `aiconfig-editor` dir and run `yarn && yarn build` before running `npm publish`. `yarn build` will compile the react code to commonjs and esm format files & source maps (separated by specific folders) and the appropriate type declarations. This will allow the package to be used in most js projects.

We can't land this as-is because it essentially breaks the dev x, preventing HMR from working. The next couple diffs should fix that.
# Use react-app-rewired and react-app-rewire-alias for DevX

The first step in fixing the DevX for the new packaging structure is to get HMR working to ensure changes to code get reflected in the browser during development. This PR leverages `react-app-rewired` and `react-app-rewire-alias` to allow us to:
1. Override the default configurations set in place by the `react-scripts` setup we're using (mainly, webpack configuration)
2. Specify aliases for paths, which enables us to link to our local aiconfig-editor package code instead of the node modules package

Unfortunately, 2. only applies to the react code itself right now, NOT type declarations. So, you can do something like remove/change existing components in jsx, but changing their props will not be reflected in HMR...

Next PR should fix that
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.

1 participant