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

removeCombined and shared dependencies #958

Open
platinumazure opened this issue Apr 17, 2017 · 0 comments
Open

removeCombined and shared dependencies #958

platinumazure opened this issue Apr 17, 2017 · 0 comments

Comments

@platinumazure
Copy link

I'm in a codebase where we have modules that are composed both of self-contained dependencies and shared helpers. We'd love to use removeCombined but unfortunately some files need to stick around for future module combinations.

Example directory structure:

+ helpers
| |
| -- someHelper
+ src
  |
  + module1
  | |
  | -- mainModuleFile1
  | -- selfContainedDependency1
  + module2
    |
    -- mainModuleFile2
    -- selfContainedDependency2

In this example, src/mainModuleFile1 and src/mainModuleFile2 are the modules that should be generated. Each one requires the "selfContainedDependency" file in its folder plus helpers/someHelper.

A few possible ways around this:

  • Allow removeCombined to be a predicate function (returning true/false, where true implies file can be safely removed as if removeCombined=true had been set)
    • If r.js supported a predicate removeCombined function, we could remove only the "selfContainedDependency" files and leave the helpers/someHelper file.
  • Add an option to avoid removing files that are outside of the directory the main module file is in (I'm not a fan of this due to coupling module names with filesystem which might not work for plugins)

I'm happy to work on a pull request if you are willing to accept either of the options above or have any other suggestions.

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