I am upgrading my Sapper application to SvelteKit. I can run npm run dev fine and it starts my application on localhost:3000. When I browse to that URL, I get the following error:
SyntaxError: Unexpected token (6:180)
at Object.pp$4.raise (../node_modules/vite/dist/node/chunks/dep-66eb515d.js:35308:13)
at Object.pp.unexpected (../node_modules/vite/dist/node/chunks/dep-66eb515d.js:32999:8)
at Object.pp.expect (../node_modules/vite/dist/node/chunks/dep-66eb515d.js:32993:26)
at Object.pp$3.parseObj (../node_modules/vite/dist/node/chunks/dep-66eb515d.js:34944:12)
at Object.pp$3.parseExprAtom (../node_modules/vite/dist/node/chunks/dep-66eb515d.js:34683:17)
at Object.pp$3.parseExprSubscripts (../node_modules/vite/dist/node/chunks/dep-66eb515d.js:34509:19)
at Object.pp$3.parseMaybeUnary (../node_modules/vite/dist/node/chunks/dep-66eb515d.js:34486:17)
at Object.parseMaybeUnary (../node_modules/vite/dist/node/chunks/dep-66eb515d.js:43031:29)
at Object.pp$3.parseExprOps (../node_modules/vite/dist/node/chunks/dep-66eb515d.js:34421:19)
at Object.pp$3.parseMaybeConditional (../node_modules/vite/dist/node/chunks/dep-66eb515d.js:34404:19)
I can't figure out the point this error is being raised. Can anyone suggest a place to look?
My svelte.config.cjs is
const node = require('@sveltejs/adapter-node');
module.exports = {
kit: {
// By default, `npm run build` will create a standard Node app.
// You can create optimized builds for different platforms by
// specifying a different adapter
adapter: node(),
// hydrate the <div id="svelte"> element in src/app.html
target: '#svelte',
vite: {
ssr: {
noExternal: ['node-fetch']
}
}
}
};
My package.json includes the follows
"dependencies": {
"typescript": "^4.2.4",
"node-fetch": "^2.6.1",
"@sveltejs/vite-plugin-svelte": "^1.0.0-next.5"
},
"devDependencies": {
"@sveltejs/kit": "next",
"vite": "^2.1.5",
"@sveltejs/adapter-node": "next",
"svelte": "^3.35.0",
"svelte-flex": "^1.2.2",
"svelte-simple-modal": "^0.9.0"
}