Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compile, Mdsvex imports error on Join #412

Open
Tracked by #590
techydad05 opened this issue Jan 31, 2022 · 6 comments
Open
Tracked by #590

Compile, Mdsvex imports error on Join #412

techydad05 opened this issue Jan 31, 2022 · 6 comments
Labels
assigned Whether or not this bug has been assigned some to some other issues as a subtask or pre-req environment An issue with the environment

Comments

@techydad05
Copy link

I am using a bare sveltekit demo app and am simply using import { mdsvex, compile } from 'mdsvex'; on one of my routes to make a preview container. It breaks my app with this error node_modules/mdsvex/dist/main.es.js:2:24: error: No matching export in "browser-external:path" for import "join" 2 │ import path__default, { join } from 'path';
I have tried import each separately and its the same thing.
Any help would be appreciated! Thanks.

@Feuerhamster
Copy link

Same problem here.

I want to render markdown in a component using the compile function in the components script tag and I get the same error.

@miedzikd
Copy link

miedzikd commented Mar 5, 2022

Same problem for me... Everything work if I use compile function in .ts or .js files. But when I try use compile inside .svelte file then I got this error

@git-no
Copy link

git-no commented Mar 30, 2022

Same problem here.

@zmre
Copy link

zmre commented Mar 31, 2022

I'm having the same issue. Because of the note by @miedzikd, I tried moving the .compile() call into a .ts file so hoping I could call a utility function as a workaround, but that resulted in the same error. Does anyone have a workaround?

@raphet
Copy link

raphet commented Jun 8, 2022

I'm having the same issue.
We get markdown from a REST endpoint.
This content is not stored in physical .md or .svx files. So it appears the intended way to cover this scenario is through .compile() which throws above error.

A workaround would be highly appreciated.

@kmalkenneth
Copy link

You can only use it on one endpoint.

import { compile } from 'mdsvex';

/** @type {import('@sveltejs/kit').RequestHandler} */
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
export async function get() {
	const transformed_code = await compile(
		`
        <script>
            import { LogoApp } from '$lib/components';            
        </script>

        <LogoApp></LogoApp>

        # Hello friends

        Esto es una prueba de **markdown**
        `
        );

	const data = transformed_code;

	console.log(data);

	const body = {
		data
	};

	return { body: body };
}

But many functionalities are lost. Such as the layout and the import of components.

@pngwn pngwn added environment An issue with the environment assigned Whether or not this bug has been assigned some to some other issues as a subtask or pre-req labels Feb 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
assigned Whether or not this bug has been assigned some to some other issues as a subtask or pre-req environment An issue with the environment
Projects
None yet
Development

No branches or pull requests

8 participants