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

Does cjstoesm get dependent sources from node_modules (am I using it correctly)? #19

Open
veikkoeeva opened this issue Jun 17, 2021 · 0 comments

Comments

@veikkoeeva
Copy link

I was using this module to try to solve a pesky Error: 'default' is not exported by node_modules\<xyz> problem. But it didn't go as planned, so in my desperation reaching here to double-check if this is a problem that in principle is what this module should solve. 🔢

As it may be that I do not understand correctly that if this module indeed would solve, at least in some cases, such problems. It looks to be these are because of UMD -> ES6 export changes, but I may be wrong. The other things are that I think I should also use @rollup/plugin-node-resolve to resolve paths. Is this right?

I have defined

import resolve from '@rollup/plugin-node-resolve';
import ts from "@wessberg/rollup-plugin-ts";
import {cjsToEsm} from "cjstoesm";

[...]

plugins: [    
    resolve({ browser: true, preferBuiltins: true }),
    ts({ transformers: [cjsToEsm()] })
  ]

Another thing is, does this plugin pick up also the dependencies that are referenced by the libraries imported by the code?

(That config is at https://github.com/veikkoeeva/erc1155sample/blob/main/web/rollup.config.js#L27 if it matters, and strangely there is a difference in output if I move it from baseConfig to the merge section, though it's not related to this module).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant