Unable to load jquery.js file under content script directory
Everything is fine during the dev mode, but after run yarn build and reload the extension, the dev console shows the error:
I can find jquery.js in the Sources tab, and $ can be successfully called in the dev console
manifest.ts content like below
content_scripts: [
{
matches: omit,
js: [
'src/contentScript/jquery.js',
'src/contentScript/index.ts',
],
css: omit,
run_at: 'document_start',
},
],
Try importing jQuery directly in your index.ts
Install jQuery
yarn add jquery
index.ts
import $ from "jquery";
Try importing jQuery directly in your index.ts
Install jQuery
yarn add jqueryindex.ts
import $ from "jquery";
Thank you for your advice. I haven't tested it yet, because jquery.js is just one example. If otherA.js contains a function A and otherB.js contains a function B, how should I call these methods A and B in index.ts?
Try importing jQuery directly in your index.ts
Install jQuery
yarn add jqueryindex.ts
import $ from "jquery";Thank you for your advice. I haven't tested it yet, because jquery.js is just one example. If otherA.js contains a function A and otherB.js contains a function B, how should I call these methods A and B in index.ts?