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

Circular dependency when building with rollup #2

Open
arbesfeld opened this issue Sep 14, 2016 · 4 comments
Open

Circular dependency when building with rollup #2

arbesfeld opened this issue Sep 14, 2016 · 4 comments

Comments

@arbesfeld
Copy link

I had to comment out custom.js in order to package this up with rollup, as it seems like this circular dependency is not getting resolved correctly:

https://github.com/benjamn/arson/blob/master/custom.js#L11

Is there a way that we'd be able to reorganize the code to not make this a problem? Happy to submit a PR if we can come up with a solution.

@benjamn
Copy link
Owner

benjamn commented Sep 15, 2016

This package uses pure CommonJS, which allows circular requires, and it works in Node. I also thought Rollup was only for ES2015 import and export? What's the error?

@arbesfeld
Copy link
Author

arbesfeld commented Sep 15, 2016

I should clarify that we are using https://github.com/rollup/rollup-plugin-commonjs to bundle your library.

Here is the error that I am seeing at runtime:

LogRocket.js:2145 Uncaught TypeError: Cannot read property 'registerType' of undefined(anonymous function) 
@ LogRocket.js:2145createCommonjsModule 
@ LogRocket.js:11(anonymous function) 
@ LogRocket.js:2136(anonymous function) 
@ LogRocket.js:10089
VM424:2 Uncaught TypeError: Cannot read property 'config' of undefined(anonymous function) @ VM424:2

Happy to produce a minimum reproduction if you think it might be helpful.

@1j01
Copy link

1j01 commented Jun 2, 2019

Instead of the circular require, custom.js could export a function registerTypes(arson), which would be a simple way to resolve this. (I'm not running into this, but just throwing in my two cents.)

@KnorpelSenf
Copy link

#16 might help as it does not have any circular dependencies.

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

4 participants