marp-team / marp-core

The core of Marp converter
MIT License
766 stars 129 forks source link

Usage or marp-core in browser context #314

Closed sinedied closed 1 year ago

sinedied commented 2 years ago

Hello!

I'm interested in integrating @marp-team/marp-core in an existing Angular app to convert markdown on-the-fly. But when I'm following the base instructions, I get this error in the browser: image

It seems that some CJS dependencies relies on Node-specific features like __dirname, breaking code execution. Is there a workaround or a pre-built marp-core that we could use?

Thanks

yhatt commented 2 years ago

I found postcss-minify-params for CSS minification is depending on CJS __dirname. https://github.com/cssnano/cssnano/blob/747f16c36f30f0f97e6b6793b8952b3e7d890025/packages/postcss-minify-params/src/index.js#L99

This error is not what we expected so I'm considering to deal with this by some way, but you can try to disable CSS minification by minifyCSS: false constructor option as a workaround.

const marp = new Marp({ minifyCSS: false });
sinedied commented 2 years ago

Thanks, I'll try that!