talha khalid
talha khalid

Reputation: 301

how can we require node_module in out chrome extension?

how can we require node_module in out chrome extension?....because Trying to require() a package means that node will try to locate its files in your file system. A chrome extension only has access to the files you declare in the manifest, not your filesystem. so how is it possible?

Upvotes: 1

Views: 159

Answers (1)

magne4000
magne4000

Reputation: 151

Using a bundler like Webpack can solve your issue (if your packages do not contain any binaries). It requires a bit of configuration if you have different endpoints (content_scripts, background page, popup, etc.). Libs such as webpack-extension-reloader also helps a lot.

Upvotes: 1

Related Questions