Reputation: 2325
Why is my background.html page throwing this:
Uncaught SyntaxError: Unexpected token <
in line 1
Here is the actual html:
<html>
<head>
<script type="text/javascript" src="fancy-settings/source/lib/store.js"></script>
<script type="text/javascript" src="background.js"></script>
</head>
<body></body>
</html>
So chrome complains about the first opening "<" and I have no idea why.
Upvotes: 8
Views: 5190
Reputation: 11
If you are using Manifest V3, just add type: "module" in the background
{
...
"background": {
"service_worker": "background.js",
"type": "module"
},
...
}
Upvotes: 0
Reputation: 175
I had the same issue. Just replace in your manifest.json
file
"background": {
"scripts": ["background.js"]
},
with:
"background": {
"page": "background.html"
},
Upvotes: 6
Reputation: 15378
remove js:
<script type="text/javascript" src="fancy-settings/source/lib/store.js"></script>
<script type="text/javascript" src="background.js"></script>
If the error persists, then you are not hooked up correctly js
Upvotes: 1