Skip to content

feat: Replace react-script to vite - #3327

Merged
Keith-CY merged 8 commits into
nervosnetwork:developfrom
devchenyan:feat-356
Mar 11, 2025
Merged

feat: Replace react-script to vite#3327
Keith-CY merged 8 commits into
nervosnetwork:developfrom
devchenyan:feat-356

Conversation

@devchenyan

@devchenyan devchenyan commented Mar 8, 2025

Copy link
Copy Markdown
Contributor

@devchenyan
devchenyan marked this pull request as ready for review March 8, 2025 17:15
@devchenyan
devchenyan marked this pull request as draft March 9, 2025 02:50
Comment thread packages/neuron-wallet/src/controllers/app/index.ts Fixed
@devchenyan

devchenyan commented Mar 9, 2025

Copy link
Copy Markdown
Contributor Author

/package
Packaging for test is done in 13750534503. @devchenyan

@devchenyan
devchenyan marked this pull request as ready for review March 9, 2025 16:51
Comment thread package.json
Comment thread packages/neuron-ui/src/components/GeneralSetting/index.tsx
@Keith-CY
Keith-CY requested a review from Copilot March 10, 2025 06:21

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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

Keith-CY commented Mar 10, 2025

Copy link
Copy Markdown
Contributor

/package
Packaging for test is done in 13758707692. @Keith-CY

@Keith-CY
Keith-CY added this pull request to the merge queue Mar 11, 2025
Merged via the queue into nervosnetwork:develop with commit 201744b Mar 11, 2025
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.

5 participants