question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error adding adapter: Malformed svelte.config.js SyntaxError: Unexpected token '.'

See original GitHub issue

Describe the bug

When I add the line import firebase from "svelte-adapter-firebase"; I get the following error:

Malformed svelte.config.js
SyntaxError: Unexpected token '.'
    at Loader.moduleStrategy (internal/modules/esm/translators.js:140:18)

To Reproduce

$ npm init svelte@next sveltekit-firebase-test

In package.json fix the @sveltejs/kit version

  "devDependencies": {
    "@sveltejs/kit": "1.0.0-next.107",
$ npm install

$ firebase init

$ npm install --save-dev svelte-adapter-firebase

Add the line

import firebase from "svelte-adapter-firebase";

at the beginning of svelte.config.js

run npm run build

$ npm run build

> ~TODO~@0.0.1 build /home/sas/devel/apps/glas-it/apps/keyosk/tmp/sveltekit-firebase-test
> svelte-kit build

Malformed svelte.config.js
SyntaxError: Unexpected token '.'
    at Loader.moduleStrategy (internal/modules/esm/translators.js:140:18)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! ~TODO~@0.0.1 build: `svelte-kit build`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the ~TODO~@0.0.1 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/sas/.npm/_logs/2021-05-25T20_59_11_043Z-debug.log

Expected behavior

The build to run ok

Additional context

package.json

{
  "name": "~TODO~",
  "version": "0.0.1",
  "scripts": {
    "dev": "svelte-kit dev",
    "build": "svelte-kit build",
    "preview": "svelte-kit preview"
  },
  "devDependencies": {
    "@sveltejs/kit": "1.0.0-next.107",
    "svelte": "^3.34.0",
    "svelte-adapter-firebase": "^0.7.7"
  },
  "type": "module",
  "dependencies": {
    "@fontsource/fira-mono": "^4.2.2",
    "@lukeed/uuid": "^2.0.0",
    "cookie": "^0.4.1"
  }
}
$ node --version
v12.22.1

$ npm --version
6.14.12

Note: there’s a github repo with the example producing the above erro at https://github.com/opensas/sveltekit-firebase-adapter-error

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
jthegeduscommented, May 26, 2021

functions init now defaults to Node.js 14 - https://github.com/firebase/firebase-tools/releases/tag/v9.12.0

1reaction
jthegeduscommented, May 25, 2021

This adapter currently forces you use Node.js 14 Functions for SvelteKit.

I may look at reducing this to 12 if possible. And even if not, the error should be better.

Thanks for reporting. I will look to resolve sometime this week. Please use Node.js 14 in the meantime.

Read more comments on GitHub >

github_iconTop Results From Across the Web

adapter-static fails with ESM config · Issue #1311 · sveltejs/kit
I'm trying to use adapter static too, but weirdly when I try to use .cjs it spits out this error svelte.config.cjs should be...
Read more >
I'm getting an error building a sveltekit project - Stack Overflow
Here is my attempted svelte.config.js file: // @type {import('@sveltejs/kit').Config} var config; import adapter from '@sveltejs/adapter ...
Read more >
How to fix Unexpected Token in JSON error (for ... - YouTube
Not a programmer? Read this! ** - If you get this error in an app you didn't make, and/or you're not a web...
Read more >
unexpected token "export" when importing a library -500 error
Hi Just started a new svelte-kit project. When importing my library - which loads a dependency library called Ionic, I get the error...
Read more >
unexpected token 'export' at object.compilefunction (node:vm ...
The "Uncaught SyntaxError Unexpected token 'export'" occurs for 2 main reasons: Using the ES6 Module syntax in a Node.js application without type to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found