Svelte - Unexpected token (parse-error)

It seems like Parcel fails to parse this in a Svelte popup:
const errorMessage = {
youtube: "Cannot assign. Used by YouTube",
alreadyInUse: "Cannot assign. Already in use"
} as const;
const errorMessage = {
youtube: "Cannot assign. Used by YouTube",
alreadyInUse: "Cannot assign. Already in use"
} as const;
because of the as const part Plsamo version: 0.60.3-lab.2
79 Replies
Avi
Aviā€¢2y ago
After removing it, it seems like this is an invalid syntax:
const keysSet = new Set<string>();
^
const keysSet = new Set<string>();
^
Removing .plasmo/ doesn't solve the issue either
lab
labā€¢2y ago
Try verbose logging and see if it spits out any other info :d
Avi
Aviā€¢2y ago
I did try, that's how I found out that the aforementioned lines were problematic
Avi
Aviā€¢2y ago
lab
labā€¢2y ago
At the bottom of the code pasting, is there a stack trace?
Avi
Aviā€¢2y ago
:global(.mdc-data-table__cell.mdc-data-table__cell:first-of-type) {
vertical-align: top;
}</style>

šŸŸ” 19 | C:\repositories\extensions\youtube-like-dislike-shortcut-plasmo\src\popup\components\ButtonCustomization.svelte:25:35
:global(.mdc-data-table__cell.mdc-data-table__cell:first-of-type) {
vertical-align: top;
}</style>

šŸŸ” 19 | C:\repositories\extensions\youtube-like-dislike-shortcut-plasmo\src\popup\components\ButtonCustomization.svelte:25:35
Only the problematic line
lab
labā€¢2y ago
what happens if you move that component outside of popup directory?
Avi
Aviā€¢2y ago
Move the file and remove the references to it, or just move?
lab
labā€¢2y ago
you prob need to replace the reference too yeah - tho in my project when I move files around they automatically replace the path for me
Avi
Aviā€¢2y ago
My WebStorm also did it, but the error is the same
lab
labā€¢2y ago
I'm not entirely sure yeah, this is the TS in svelte territory, this error comes from the TS checker within Svelte
Avi
Aviā€¢2y ago
I mean visually there aren't issues
lab
labā€¢2y ago
šŸ”“ ERROR | Unexpected token (parse-error)
Also this error could indicates hidden token btw afaik, this happens when you have a whitespace character somewhere that messed up the whole file
Avi
Aviā€¢2y ago
Maybe it has to do with the tsconfig.json How should it look like?
lab
labā€¢2y ago
It looks like this on the example:
{
"extends": "plasmo/templates/tsconfig.base",
"exclude": ["node_modules"],
"include": ["./**/*.ts", "./**/*.tsx", "./**/*.svelte"],
"compilerOptions": {
"paths": {
"~*": ["./*"]
},
"baseUrl": "."
}
}
{
"extends": "plasmo/templates/tsconfig.base",
"exclude": ["node_modules"],
"include": ["./**/*.ts", "./**/*.tsx", "./**/*.svelte"],
"compilerOptions": {
"paths": {
"~*": ["./*"]
},
"baseUrl": "."
}
}
Want results from more Discord servers?
Add your server