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

Save location where a config setting was set #9

Open
vjpr opened this issue Oct 27, 2015 · 0 comments
Open

Save location where a config setting was set #9

vjpr opened this issue Oct 27, 2015 · 0 comments

Comments

@vjpr
Copy link

vjpr commented Oct 27, 2015

This would be super cool, but could be a bit complex.

Using the callsite npm module, whenever a configurator method is called, for each plain object modified, add a hidden $callsite: [] field, and store the filename and line number of the file that set it. Each modification is pushed to the array.

Then in the print method, you could indicate in which file a particular config key was set.

Why?

When splitting up configs, and maybe having some default configs come from an npm module, it would be useful to know where the setting was set.

Layering configs based on function is useful. E.g. the inclusion of a single module may require a few configurations. If this module is removed, or disabled, so should the webpack config. In the other direction, it would allow you to construct configs automatically when including a module that requires some configs.

Lots of modules require certain webpack config settings.

Examples:

  • bootstrap-sass-loader requires you to add this config for fonts, and a jquery import setting, and a plugin!
  • Protobufjs requires
    resolve.alias: {
      protobufjs: 'protobufjs/dist/ProtoBuf-light', // `-light` = don't include .proto loader. We only use JSON loader.
      ByteBuffer: 'bytebuffer',
      Long: 'long',
    }

But this layering requires easy to access printing of resolved configs and tracing where options are set from otherwise you end up in config hell!

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