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

module path override is undocumented #35

Open
ahdinosaur opened this issue Mar 28, 2017 · 8 comments
Open

module path override is undocumented #35

ahdinosaur opened this issue Mar 28, 2017 · 8 comments

Comments

@ahdinosaur
Copy link
Member

from https://github.com/depject/depject/blob/master/index.js#L47-L55,

if you have a module at the same "path" as another module, it will override the previous module (as opposed to say, being merged via first, map, or reduce).

@ahdinosaur
Copy link
Member Author

i'm also not convinced this behavior is a good idea. what about if we instead had something like #16?

@dominictarr
Copy link
Collaborator

a decision like this must be discussed with respect to specific use-cases, I don't know how you are intending to use this. currently this feature is actually used, say patchwork overrides patchcore's default renderers. I admit that it's a crude mechanism, but more importantly it's a simple one.

but you are correct it is undocumented.

@ahdinosaur
Copy link
Member Author

I don't know how you are intending to use this.

my current situation is that i spent over an hour trying to figure out why a module was being disappeared, only to realize it was because the paths matched and therefore the latter ate the former. i haven't yet had a use case for this feature.

@dominictarr
Copy link
Collaborator

sure, but tell us more about how that happened

@dominictarr
Copy link
Collaborator

the simple way to get the behaviour you want is to have the top level of nest, as passed to combine to be the name of that layer: eg, combine({core: ...}, {userland: ...}) note that this nesting is separate to the api nesting within modules.

@ahdinosaur
Copy link
Member Author

it happened by calling combine(userland, core), where userland and core are both objects created with bulk-require, where file paths almost always correlate to plug paths.

@dominictarr
Copy link
Collaborator

you can still do {userland: bulkRequire(...)} though right?

@ahdinosaur
Copy link
Member Author

@dominictarr yep, that's a great suggestion.

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

2 participants