Skip to content

Set Up dev 'watch' for aiconfig-editor declarations HMR#955

Draft
rholinshead wants to merge 3 commits intomainfrom
pr955
Draft

Set Up dev 'watch' for aiconfig-editor declarations HMR#955
rholinshead wants to merge 3 commits intomainfrom
pr955

Conversation

@rholinshead
Copy link
Member

@rholinshead rholinshead commented Jan 18, 2024

@rholinshead rholinshead changed the title Set Up dev 'watch' for aiconfig-editor declarations HMR [WIP] Set Up dev 'watch' for aiconfig-editor declarations HMR Jan 18, 2024
Ryan Holinshead added 3 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
@rholinshead rholinshead changed the title [WIP] Set Up dev 'watch' for aiconfig-editor declarations HMR Set Up dev 'watch' for aiconfig-editor declarations HMR Jan 26, 2024
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