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

[BUG] Wrong identifier name with strict esm #210

Closed
1 task done
Mister-Hope opened this issue Nov 26, 2023 · 6 comments
Closed
1 task done

[BUG] Wrong identifier name with strict esm #210

Mister-Hope opened this issue Nov 26, 2023 · 6 comments
Labels
bug Something isn't working

Comments

@Mister-Hope
Copy link
Contributor

Mister-Hope commented Nov 26, 2023

  • I have searched for existing issues that already reported this problem and found none

Describe the bug

The following are dist file of markmap-toolbar/dist/index.mjs, which is supposed to use under esm env.

/*! markmap-toolbar v0.15.4 | MIT License */
import { mountDom } from '@gera2ld/jsx-dom';
import { jsx, jsxs, Fragment } from '@gera2ld/jsx-dom/jsx-runtime';
// ...

However, the '@gera2ld/jsx-dom/jsx-runtime' is not resolvable under strict esm env, as every file requires externsion, and @gera2ld/jsx-dom has no export field that declares /jsx-runtime export.

So I am getting:

demo/md-enhance demo:webpack-build:   message: "Module not found: Error: Can't resolve '@gera2ld/jsx-dom/jsx-runtime' in '/home/runner/work/vuepress-theme-hope/vuepress-theme-hope/node_modules/.pnpm/markmap-toolbar@0.15.4_markmap-common@0.15.3/node_modules/markmap-toolbar/dist'\n" +
demo/md-enhance demo:webpack-build:     "Did you mean 'jsx-runtime.js'?\n" +
demo/md-enhance demo:webpack-build:     "BREAKING CHANGE: The request '@gera2ld/jsx-dom/jsx-runtime' failed to resolve only because it was resolved as fully specified\n" +
demo/md-enhance demo:webpack-build:     `(probably because the origin is strict EcmaScript Module, e. g. a module with javascript mimetype, a '*.mjs' file, or a '*.js' file where the package.json contains '"type": "module"').\n` +
demo/md-enhance demo:webpack-build:     'The extension in the request is mandatory for it to be fully specified.\n' +
demo/md-enhance demo:webpack-build:     'Add the extension to the request.',

The problem should belong to your bundling logic, to make things right, it should be :

- import { jsx, jsxs, Fragment } from '@gera2ld/jsx-dom/jsx-runtime';
+ import { jsx, jsxs, Fragment } from '@gera2ld/jsx-dom/jsx-runtime.js';
@Mister-Hope Mister-Hope added the bug Something isn't working label Nov 26, 2023
@Mister-Hope
Copy link
Contributor Author

Mister-Hope commented Nov 26, 2023

Currently I will try to patch this dep to avoid problem, but I am creating a tool which depends on mindmap while I can not apply my patch downstream.

It would be great if you can managed to fix this critical issue ASAP @gera2ld

@Mister-Hope
Copy link
Contributor Author

Update: to speed up this apply, I try to make a PR to fix it, but it seems that you are creating wrapper package about rollup of your own:

    "@gera2ld/plaid": "~2.5.9",
    "@gera2ld/plaid-common-ts": "~2.5.9",
    "@gera2ld/plaid-rollup": "~2.5.9",
    "@gera2ld/plaid-test": "~2.5.9",

Which confuses me, and stop me from raising a valid PR. Maybe you should check that yourself?

@gera2ld
Copy link
Member

gera2ld commented Nov 26, 2023

Could you help to verify in markmap-toolbar@0.15.5-alpha.1? Thanks.

@Mister-Hope
Copy link
Contributor Author

It works, thanks

@gera2ld
Copy link
Member

gera2ld commented Nov 27, 2023

FYI 0.15.5 has been released

@yimuc
Copy link

yimuc commented Mar 17, 2024

Hello, can you export umd packages? @gera2ld

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

No branches or pull requests

3 participants