Closed artnaseef closed 1 year ago
microbundle-crl
is an unmaintained fork that can be found here.
Have you tried using microbundle
itself?
microbundle-crl
is an unmaintained fork that can be found here.Have you tried using
microbundle
itself?
OK, I'll try. FYI - I saw that CRL was separate, looked at it's NPM page for the github link, which brought me back here. In addition, I saw talk of merging it back into this project. And create-react-library still seems to use the CRL one (unless I failed to update it properly), so .... I'm confused.
Just switching microbundle-crl
to microbundle
:
"build": "microbundle --no-compress --format modern,cjs",
"start": "microbundle watch --no-compress --format modern,cjs",
"microbundle": "^0.15.1",
I'm getting the same error when using --external=none
- the import fails.
Do you have a reproduction?
Are there any examples around where the inlined dependency with an import works?
Can you share any ideas on how to track down the problem?
I'm not quite sure what "inlined dependency with an import works" means, to be quite honest.
If you can provide a reproduction, I can take a look.
In node-client, my source has an import of contract-client, like this:
import { NotTheRealName } from 'contract-client';
contract-client
into node-client
.--external none
), complains that contract-client
does not export NotTheRealName
.--external none
- it compiles just fine, so the import works, but then contract-client remains an external dependencyWe need a repo we can clone, trying to guess your project's structure and configuration isn't a good use of anyone's time.
Here is an POC that reproduces the problem:
Can we remove the CRL label on this issue since CRL is no longer involved?
npm ERR! Error: 'NotTheRealName' is not exported by ../contract-client/dist/index.js, imported by AnotherBogusName.ts
This is the correct behavior. You're referencing a built CJS package as an input and trying to import from it -- microbundle
does not support this behavior.
Provide an ESM output for aaa-contract-client
. You can have microbundle
build aaa-contract-client
, run tsc
twice with different configs, etc. Just ensure there's ESM output for it to process.
In the future, please provide a minimal reproduction for issues (on any repo, not just this one). When you have a whole bunch of entirely unrelated configs and dependencies, it slows down the maintainer trying to help you.
In the future, please provide a minimal reproduction for issues (on any repo, not just this one). When you have a whole bunch of entirely unrelated configs and dependencies, it slows down the maintainer trying to help you.
Thank you for the feedback - I actually figured this out on my own (using strace
to track back to rollupjs
).
While we are on the topic of "please provide a minimal..." - I get it. I work on opensource as well (feel free to google it). But really - you couldn't come up with "check your module packaging" without it?
In the future Ryan - please do me a favor. Don't help.
BTW, who actually solved this one?
If you had already figured this out yourself, a heads up/closing of the issue would be nice.
But really - you couldn't come up with "check your module packaging" without it?
Are you asking if I had to clone your repo and build both packages to observe what was wrong? Er, yes, I did. It would've been helpful if I didn't need to clean up the package.json
dependencies and extraneous config files first is all.
In the future Ryan - please do me a favor. Don't help.
Yeah this isn't a way to thank someone volunteering time to help you.
BTW, who actually solved this one?
Not quite sure what you're asking?
I am trying to inline a dependency and when I do, I get failed imports.
Module (1) (called contract-client) is an auto-generated contract library (using openapi generator). Module (2) (called node-client) is the library I'm developing and releasing.
When I build node-client using the following (populated by
create-react-library
), the library builds and packages, but the output includes arequire('contract-client')
call - which fails downstream:So, I found
inline
. And tried it. The result was the same as putting the dependency in "devDependencies" - I get an error like this when building node-client:Here is how I forced inlining:
Please help!