3rippleflex
3rippleflex

Reputation: 31

How do I fix "Cannot use import statement outside a module" in my Chrome Extension content script?

I'm developing a Chrome extension (Manifest V3) and using ES6 modules in my content script (content.js). My code starts with:
enter image description here erro

However, when the extension loads on https://nkiri.com/, I get the following error in the console:

"Uncaught SyntaxError: Cannot use import statement outside a module"

I've tried:

My question is: What is the best approach to use ES6 modules in a Chrome extension content script, and how can I resolve this error?

Environment Details:

Any guidance or examples would be greatly appreciated!

Upvotes: 0

Views: 15

Answers (0)

Related Questions