Support Forums

SvelteKit Deploy error using import { mdsvex } from "mdsvex"

I am having issues deploying a Sveltekit site to netlify. I attempted to deploy directly from github and was hit with a build error. I then looked up a video guide which used .toml file to help netlify with the build process. I follow this exactly but still got a build error.

I noticed in my build logs I get an error saying…

malformed svelte.config.js
2:34:57 PM: file:///opt/build/repo/svelte.config.js:1
2:34:57 PM: import { mdsvex } from “mdsvex”;
2:34:57 PM: ^^^^^^
2:34:57 PM: SyntaxError: The requested module ‘mdsvex’ does not provide an export named 'mdsvex’

mdsvex is a markdown processor I will use for my blog. I am assuming this is the error causing the build to fail, but I am not sure. I am also not sure why it is giving an error, as markdown is working fine in my application ( although I haven’t built the fill blog system just yet ).

Any Ideas ? I will also leave another part of my build logs below.

2:34:57 PM: npm ERR! errno 1
2:34:57 PM: npm ERR! ~TODO~@0.0.1 build: svelte-kit build
2:34:57 PM: npm ERR! Exit status 1
2:34:57 PM: npm ERR!
2:34:57 PM: npm ERR! Failed at the ~TODO~@0.0.1 build script.
2:34:57 PM: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2:34:58 PM: npm ERR! A complete log of this run can be found in:
2:34:58 PM: npm ERR! /opt/buildhome/.npm/_logs/2021-08-18T22_34_57_992Z-debug.log
2:34:58 PM: ​
2:34:58 PM: ────────────────────────────────────────────────────────────────
**2:34:58 PM: “build.command” failed **
2:34:58 PM: ────────────────────────────────────────────────────────────────
2:34:58 PM: ​
2:34:58 PM: Error message
2:34:58 PM: Command failed with exit code 1: npm run build
2:34:58 PM: ​
2:34:58 PM: Error location
2:34:58 PM: In build.command from netlify.toml:
2:34:58 PM: npm run build
2:34:58 PM: ​
2:34:58 PM: Resolved config
2:34:58 PM: build:
2:34:58 PM: command: npm run build
2:34:58 PM: commandOrigin: config
2:34:58 PM: publish: /opt/build/repo/build
2:34:58 PM: publishOrigin: config
2:34:58 PM: functionsDirectory: /opt/build/repo/functions

Hi @Netlified,

It would be great if you could share your repo. From the error message, it looks like a problem with the library/bundler choice. According to the docs:

the import syntax is used when using rollup and require syntax is used when using Webpack. So, depending on your config, you might have to choose the correct one.