79721685

Date: 2025-07-31 18:10:13
Score: 1
Natty:
Report link

The problem of not being able to use a npm library in extension development using import or require can be resolved if you use vite build tool to develop the project.

Create a new vite project npm create vite@latest

Must keep the manifest.json and icons inside the public folder. You can refer to the following folder structure. enter image description here

Build the project npm run build and your extension is ready to be tested inside the dist folder.

Now you can install and use any npm library seamlessly.

I feel this process is a bit tricky to debug if the codebase is bigger.

Reasons:
  • Blacklisted phrase (1): enter image description here
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Low reputation (1):
Posted by: Rahul Kundu