4

Since lot of js modules are in npm now a days. I was wondering if there is any way to use them directly in making of a chrome extension.

Gautham Santhosh
  • 717
  • 1
  • 8
  • 19

1 Answers1

5

Yes it is possible to use npm packages but they need to be bundled i.e. included in the extension javascript source. What you need to look into is a module bundler like webpack, rollup to create a bundle for your background scripts and/or content scripts along with the required npm packages. Your manifest should point to your bundled files and it should be working fine.

Here is an example

acesmndr
  • 7,087
  • 3
  • 22
  • 27