5

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
  • 797
  • 1
  • 10
  • 21

1 Answers1

6

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
  • 8,137
  • 3
  • 23
  • 28