refactor: separate packages for Vue, React and Nuxt#34
refactor: separate packages for Vue, React and Nuxt#34
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
comark
@comark/nuxt
@comark/react
@comark/vue
@comark/plugin-cjk
@comark/plugin-math
@comark/plugin-mermaid
commit: |
|
Last refactor 🤞 |
| @@ -1,9 +1,8 @@ | |||
| import { defineComarkComponent } from 'comark/vue' | |||
There was a problem hiding this comment.
This seems wrong, as the defineComarkComponent fn is still used below
There was a problem hiding this comment.
I'm noticing now that the plugins also have the same problem where they export multiple frameworks' components / are bundled (meaning lots of potential issues with package deduplication in end user apps) -- I wonder if the plugins should only export the actual Comark plugin (for example, comarkMermaid), and the framework packages (@comark/svelte, @comark/vue, etc) should re-export them:
// `@comark/svelte/plugin-mermaid`
import { comarkMermaid } from '@comark/plugin-mermaid';
import { Mermaid } from './Mermaid.svelte';
export { Mermaid, comarkMermaid }That way the vast majority of users still only have one package to install, and treeshaking will still work great...
| input: ['./src/module.ts'], | ||
| }, | ||
| ], | ||
| externals: ['@nuxt/kit', 'nuxt', 'nuxt/schema', 'vue', '@comark/vue'], |
There was a problem hiding this comment.
I think comark needs to be external as well, otherwise users who have both @comark/nuxt and comark installed will end up with two copies of comark, right?
elliott-with-the-longest-name-on-github
left a comment
There was a problem hiding this comment.
some additional questions about bundling / config that are confusing me as I work with the svelte lib
| input: ['./src/index.ts'], | ||
| }, | ||
| ], | ||
| externals: ['react', 'react/jsx-runtime', 'comark'], |
There was a problem hiding this comment.
Should have scule as well, right?
There was a problem hiding this comment.
I'm still unclear on why this package needs to be bundled at all, but if it does need to be bundled, shouldn't it externalize its dependencies?
| input: ['./src/index.ts'], | ||
| }, | ||
| ], | ||
| externals: ['comark'], |
There was a problem hiding this comment.
Same question here re: externalizing dependencies and being confused as to why we need a bundler in the first place
|
Having thought about it for most of the day, this is what's currently floating around in my head:
|
Works in production: https://comark-sample-g9zr41pys-farnabazs-projects.vercel.app/
dependencies are: