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

Support for Vite.js #40

Closed
philippkuehn opened this issue Feb 26, 2021 · 4 comments
Closed

Support for Vite.js #40

philippkuehn opened this issue Feb 26, 2021 · 4 comments
Assignees
Labels
bug Something isn't working

Comments

@philippkuehn
Copy link

philippkuehn commented Feb 26, 2021

Describe the bug
When using the next generation esm bundler vite, I'm getting this error:

 > node_modules/y-prosemirror/src/lib.js:1:26: error: No matching export for import "ProsemirrorMapping"
    1 │ import { updateYFragment, ProsemirrorMapping } from './plugins/sync-plugin.js' // eslint-disable-line
      ╵                           ~~~~~~~~~~~~~~~~~~

I think this is because ProsemirrorMapping is a type generated in the build process. Since vite (esbuild) is very strict and uses the source files, it can't find this export. Here is a comment from evan you about that.

Do you have any idea how to fix that on your side?

To Reproduce

  1. import y-prosemirror in a vite project
  2. start dev server
  3. See error

Expected behavior
It should not throw an error

@philippkuehn philippkuehn added the bug Something isn't working label Feb 26, 2021
@holtwick
Copy link

I experienced the same problem. A fix would be great, thanks.

holtwick added a commit to holtwick/y-prosemirror that referenced this issue Mar 6, 2021
Remove ProsemirrorMapping import. It is unused and causes problems with vite.js. Fixes  yjs#40
@holtwick holtwick mentioned this issue Mar 6, 2021
@holtwick
Copy link

holtwick commented Mar 6, 2021

I provided a PR that fixes the issue.

@dmonad dmonad closed this as completed in c22997a Mar 6, 2021
@dmonad
Copy link
Member

dmonad commented Mar 6, 2021

Fixed this in y-prosemirror@1.0.7

@holtwick
Copy link

holtwick commented Mar 7, 2021

Thanks @dmonad Your patch works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants