You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I come from #1295.
I have a problem when I run pnpm dev where, when I edit it auto-saves and tries to execute the content script, then the command crashes, so I have to run pnpm dev again , opening a new browser window which is really annoying. It crashes with a "BABEL_PARSER_SYNTAX_ERROR". I use svelte and wxt 0.19.13.
Log:
pnpm dev
> wxt-svelte-starter@0.0.0 dev /home/fed/Coding/WebDev/Extensions/phonetix/Phonetix
> wxt
WXT 0.19.22 2:39:04 PM
✔ Started dev server @ http://localhost:3000 2:39:05 PM
ℹ Pre-rendering chrome-mv3 for development with Vite 6.0.3 2:39:05 PM
fi
✔ Built extension in 1.578 s 2:39:07 PM
├─ .output/chrome-mv3/manifest.json 1.06 kB
├─ .output/chrome-mv3/popup.html 721 B
├─ .output/chrome-mv3/background.js 88.24 kB
├─ .output/chrome-mv3/chunks/popup-BxzUToPe.js 8.28 kB
├─ .output/chrome-mv3/content-scripts/content.js 42.3 kB
├─ .output/chrome-mv3/icon/128.png 3.07 kB
├─ .output/chrome-mv3/icon/16.png 559 B
├─ .output/chrome-mv3/icon/32.png 916 B
├─ .output/chrome-mv3/icon/48.png 1.33 kB
├─ .output/chrome-mv3/icon/96.png 2.37 kB
└─ .output/chrome-mv3/wxt.svg 1.07 kB
Σ Total size: 149.92 kB
✔ Opened browser in 1.372 s 2:39:08 PM
ℹ Press o + enter to reopen the browser 2:39:08 PM
ℹ Changed: src/entrypoints/content.ts 2:39:18 PM
/home/fed/Coding/WebDev/Extensions/phonetix/Phonetix/node_modules/.pnpm/@babel+parser@7.26.3/node_modules/@babel/parser/lib/index.js:359
const error = new SyntaxError();
^
SyntaxError: Unexpected token, expected "," (42:10)
at toParseError (/home/fed/Coding/WebDev/Extensions/phonetix/Phonetix/node_modules/.pnpm/@babel+parser@7.26.3/node_modules/@babel/parser/src/parse-error.ts:95:45)
at V8IntrinsicMixin.raise (/home/fed/Coding/WebDev/Extensions/phonetix/Phonetix/node_modules/.pnpm/@babel+parser@7.26.3/node_modules/@babel/parser/src/tokenizer/index.ts:1496:19)
at V8IntrinsicMixin.unexpected (/home/fed/Coding/WebDev/Extensions/phonetix/Phonetix/node_modules/.pnpm/@babel+parser@7.26.3/node_modules/@babel/parser/src/tokenizer/index.ts:1536:16)
at V8IntrinsicMixin.expect (/home/fed/Coding/WebDev/Extensions/phonetix/Phonetix/node_modules/.pnpm/@babel+parser@7.26.3/node_modules/@babel/parser/src/parser/util.ts:157:12)
at V8IntrinsicMixin.parseCallExpressionArguments (/home/fed/Coding/WebDev/Extensions/phonetix/Phonetix/node_modules/.pnpm/@babel+parser@7.26.3/node_modules/@babel/parser/src/parser/expression.ts:994:14)
at V8IntrinsicMixin.parseCoverCallAndAsyncArrowHead (/home/fed/Coding/WebDev/Extensions/phonetix/Phonetix/node_modules/.pnpm/@babel+parser@7.26.3/node_modules/@babel/parser/src/parser/expression.ts:883:29)
at V8IntrinsicMixin.parseSubscript (/home/fed/Coding/WebDev/Extensions/phonetix/Phonetix/node_modules/.pnpm/@babel+parser@7.26.3/node_modules/@babel/parser/src/parser/expression.ts:772:19)
at V8IntrinsicMixin.parseSubscript (/home/fed/Coding/WebDev/Extensions/phonetix/Phonetix/node_modules/.pnpm/@babel+parser@7.26.3/node_modules/@babel/parser/src/plugins/typescript/index.ts:2606:20)
at V8IntrinsicMixin.parseSubscripts (/home/fed/Coding/WebDev/Extensions/phonetix/Phonetix/node_modules/.pnpm/@babel+parser@7.26.3/node_modules/@babel/parser/src/parser/expression.ts:730:19)
at V8IntrinsicMixin.parseExprSubscripts (/home/fed/Coding/WebDev/Extensions/phonetix/Phonetix/node_modules/.pnpm/@babel+parser@7.26.3/node_modules/@babel/parser/src/parser/expression.ts:715:17) {
code: 'BABEL_PARSER_SYNTAX_ERROR',
reasonCode: 'UnexpectedToken',
loc: Position { line: 42, column: 10, index: 1479 },
pos: 1479,
syntaxPlugin: undefined,
plugin: 'wxt:remove-entrypoint-main-function',
id: '/home/fed/Coding/WebDev/Extensions/phonetix/Phonetix/src/entrypoints/content.ts',
pluginCode: '\n' +
'export default defineContentScript({\n' +
" matches: ['<all_urls>'],\n" +
' runAt: "document_start",\n' +
' main() {\n' +
' // TODO: I will use lists of IPA per language and make it possible to add multiple languages, then put them all into a set and update that set on each settings change\n' +
'\n' +
' var enabled = true\n' +
' if (enabled) {\n' +
'\n' +
' let blockTags = new Set(["SCRIPT", "STYLE"])\n' +
'\n' +
' const ActualTextNodes: NodeFilter = (node: Node): number => {\n' +
' if (node.nodeType === Node.TEXT_NODE && node.parentElement && !blockTags.has(node.parentElement?.tagName)) {\n' +
' return NodeFilter.FILTER_ACCEPT;\n' +
' }\n' +
' return NodeFilter.FILTER_REJECT;\n' +
' };\n' +
" // TODO: Currently doesn't work great with shadow root nodes\n" +
' function transformAllTextNodes() {\n' +
' const walker = document.createTreeWalker(\n' +
' document.documentElement,\n' +
' NodeFilter.SHOW_TEXT,\n' +
' ActualTextNodes\n' +
' );\n' +
' let node;\n' +
' while ((node = walker.nextNode())) {\n' +
' if (node.nodeValue?.trim()) \n' +
' node.nodeValue = transform(node.nodeValue || "");\n' +
' }\n' +
' }\n' +
'\n' +
' transformAllTextNodes();\n' +
' \n' +
' const config = { childList: true, subtree: true };\n' +
' const callback = (mutationsList: MutationRecord[]) => {\n' +
' mutationsList.forEach(mutation => \n' +
' mutation.addedNodes.forEach(node => {\n' +
' if (ActualTextNodes(node) == NodeFilter.FILTER_ACCEPT) {\n' +
' if (node.nodeValue?.trim())\n' +
' node.nodeValue = transform(node.nodeValue || ""\n' +
' }\n' +
' }\n' +
' )\n' +
' );\n' +
' };\n' +
'\n' +
' const targetNode = document.documentElement\n' +
' const observer = new MutationObserver(callback);\n' +
' observer.observe(targetNode, config);\n' +
' }\n' +
' },\n' +
'});\n' +
'\n' +
'function transform(text:string) {\n' +
' console.log(text)\n' +
' return text.toUpperCase()\n' +
'}',
frame: '40 | if (node.nodeValue?.trim())\n' +
'41 | node.nodeValue = transform(node.nodeValue || ""\n' +
'42 | }\n' +
' | ^\n' +
'43 | }\n' +
'44 | )'
}
Node.js v20.18.1
ELIFECYCLE Command failed with exit code 1.
pnpm i
pnpm dev
open a random webpage (e.g. search for apple cider vinegar)
then, in src/entrypoints/content.ts, edit e.g. in line 41 remove the last bracket.
Describe the bug
I come from #1295.
I have a problem when I run pnpm dev where, when I edit it auto-saves and tries to execute the content script, then the command crashes, so I have to run pnpm dev again , opening a new browser window which is really annoying. It crashes with a "BABEL_PARSER_SYNTAX_ERROR". I use svelte and wxt 0.19.13.
Log:
Reproduction
myproject.zip
Steps to reproduce
pnpm i
pnpm dev
open a random webpage (e.g. search for apple cider vinegar)
then, in src/entrypoints/content.ts, edit e.g. in line 41 remove the last bracket.
System Info
Used Package Manager
pnpm
Validations
The text was updated successfully, but these errors were encountered: