0

I am a big noob learning chrome extension developement.

How in the world do you import npm packages into your content scripts or the background service worker.

For example If I want to use the cheerio object to parse and scrape some html within the document in a normal script I would use

//script.js
const cheerio = require("cheerio");

I've come across many stack overflow questions and some of them said to use a bundler for all the packages, but I couldn't find any examples for implementing it in manifest v3.

I am using manifest v3 and I have tried looking for examples, but they're all in manifest v2.

I've tried to understand how webpack works and from my understanding it takes an input file, index.js, then after you do the webpack build command it outputs a main.js file with all the assets and scripts into one (I may be understanding this process incorrectly).

How do I correctly use this output, main.js, webpack file into the chrome extension manifest?

Any examples will be appreciated, thank you.

ezpzdev
  • 1
  • 2

0 Answers0