feat: Replace react-script to vite#3327
Merged
Keith-CY merged 8 commits intonervosnetwork:developfrom Mar 11, 2025
Merged
Conversation
Contributor
Author
|
/package |
3 tasks
homura
reviewed
Mar 10, 2025
Contributor
There was a problem hiding this comment.
PR Overview
This PR migrates the project from react-scripts to Vite by updating the Storybook configuration and adapting SVG asset imports. It also makes adjustments to ESLint settings and Electron mocks to support the Vite environment.
- Update Storybook configuration: switched to '@storybook/react-vite' and '@storybook/builder-vite', and re-configured the Electron alias.
- Modify ESLint configuration by adding a Vitest setup file and adjusting rules.
- Update multiple component files to import SVGs using the Vite-specific "?react" query.
- Replace process.env.NODE_ENV with import.meta.env.MODE in ErrorBoundary for environment detection.
Reviewed Changes
| File | Description |
|---|---|
| packages/neuron-ui/.storybook/main.ts | Updated Storybook config for Vite, changed framework and alias settings. |
| packages/neuron-ui/.eslintrc.js | Added Vitest setup in devDependencies and adjusted ESLint rules. |
| packages/neuron-ui/.storybook/electron.js | Converted CommonJS to ES module exports for Electron mocks. |
| packages/neuron-ui/src/components/ErrorBoundary/index.tsx | Replaced process.env check with import.meta.env.MODE for Vite usage. |
| packages/neuron-ui/src/components/LanguageDialog/index.tsx | Updated SVG icon imports to use the Vite-specific "?react" query. |
| packages/neuron-ui/src/components/NetworkSetting/index.tsx | Updated SVG icon imports to use "?react". |
| packages/neuron-ui/src/components/HardwareSign/success.tsx | Updated SVG icon imports to use "?react". |
| packages/neuron-ui/src/components/ImportHardware/import-success.tsx | Updated SVG icon import to use "?react". |
| packages/neuron-ui/src/components/OfflineSign/index.tsx | Updated SVG icon import to use "?react". |
| packages/neuron-ui/src/components/CompensationPeriodTooltip/index.tsx | Removed redundant CONSTANTS extraction and fixed import paths. |
| packages/neuron-ui/src/components/ImportHardware/import-error.tsx | Updated SVG icon import to use "?react". |
| packages/neuron-ui/src/components/ImportHardware/confirming.tsx | Updated SVG icon import to use "?react". |
| packages/neuron-ui/src/components/History/index.tsx | Updated SVG icon import to use "?react" and removed an extraneous line. |
| packages/neuron-ui/src/components/GeneralSetting/index.tsx | Updated SVG icon imports to use "?react". |
| packages/neuron-ui/src/components/ImportHardware/detect-device.tsx | Updated SVG icon import to use "?react". |
Copilot reviewed 101 out of 101 changed files in this pull request and generated no comments.
Comments suppressed due to low confidence (2)
packages/neuron-ui/.storybook/main.ts:20
- Verify that the new alias for 'electron' correctly points to the intended directory to avoid breaking Electron mocks in Storybook.
alias: { electron: path.resolve(__dirname, '../.storybook/electron') },
packages/neuron-ui/.storybook/electron.js:16
- [nitpick] If these stub functions are intentional, consider adding a comment to clarify that they are dummy implementations for Storybook use.
export const clipboard = () => {}
Keith-CY
approved these changes
Mar 10, 2025
Collaborator
|
/package |
homura
approved these changes
Mar 10, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
issue:
react-scriptto another Magickbase/neuron-public-issues#356