I had defined a content script in the manifest.json
as:
"content_scripts": [
{
"matches": [
"https://*/*"
],
"js": [
"cs.js"
]
}
]
And in cs.js
I would like to load another JS (mark.js
) as module:
// cs.js
import Mark from './lib/mark.es6.min.js'
window.onload = (event) => {
console.log(Mark)
}
and when I am visiting any page, there is an error in the console
Uncaught SyntaxError: Cannot use import statement outside a module
The directory structure looks like:
manifest.json
cs.js
lib/mark.es6.min.js
What is the best way in which I can load the mark.js to be able to use in my content script?