Skip to content

Extension reloads too frequently during development (npm run dev) #104

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

Open
mahek-crest opened this issue Feb 25, 2025 · 2 comments
Open

Comments

@mahek-crest
Copy link

mahek-crest commented Feb 25, 2025

Extension reloads too frequently during development (npm run dev)

Description

I am facing an issue where the extension keeps refreshing continuously when running npm run dev, and eventually, I get the error:

"This extension reloaded itself too frequently."

This makes it difficult to test and debug the extension during development.

Steps to Reproduce For React JS Template

  1. Clone the repository and install dependencies:
npm i

2.Run the development mode:

npm run dev
  1. Load the extension into Chrome via chrome://extensions/.
    4.Observe that the extension keeps refreshing repeatedly until the error appears.

Image

@mpodreshetnikov
Copy link

mpodreshetnikov commented Mar 6, 2025

I also have the issue. Any updates to resolve?

PS I think that problem is in vite packege. When I use vite version 4.4.11 bug disappeared,

my package.json devDependencies

"devDependencies": {
    "@crxjs/vite-plugin": "^2.0.0-beta.28",
    "@types/chrome": "^0.0.246",
    "@types/lodash": "^4.17.13",
    "@types/luxon": "^3.4.2",
    "@types/react": "^18.2.28",
    "@types/react-dom": "^18.2.13",
    "@vitejs/plugin-react": "^4.3.3",
    "gulp": "^4.0.2",
    "gulp-zip": "^6.0.0",
    "prettier": "^3.0.3",
    "typescript": "^5.2.2",
    "vite": "4.4.11"
  }

@mahek-crest
Copy link
Author

I resolved the issue caused by Vite updates by implementing the following solution:

legacy: {
   skipWebSocketTokenCheck: true,
},

and (optional, add port according to your application)

server: {
   port: 5173,
   strictPort: true,
   hmr: {
     port: 5173,
   },
}

Additionally, I referred to this GitHub issue - 74 for further insights while troubleshooting. This configuration helped resolve the issue effectively.

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

No branches or pull requests

2 participants