Skip to content

No documentation on how to work with/edit configuration #802

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

Closed
niedfelj opened this issue Sep 13, 2017 · 4 comments
Closed

No documentation on how to work with/edit configuration #802

niedfelj opened this issue Sep 13, 2017 · 4 comments

Comments

@niedfelj
Copy link

We use expose-loader and some resolve aliases, but the latest webpacker doesn't have any documentation on how to use these with environment.js to edit the environment before toWebpackConfig()...in fact, looking at the source code this doesn't seem possible, so maybe the call toWebpackConfig() should be in environment.js and not in each separate environment so we can make config changes in one spot for global items?

@rossta
Copy link
Member

rossta commented Sep 18, 2017

@niedfelj Do the docs at https://github.com/rails/webpacker/blob/master/docs/webpack.md help?

There is an API to edit some aspects of the environment, like setting/overriding plugins and loaders.

Thoughts on what else this should cover?

@niedfelj
Copy link
Author

@rossta Yes, this goes a long way to explaining the configuration. I think it should be included or linked from the main doc?

@rossta
Copy link
Member

rossta commented Sep 18, 2017

I can't speak for the maintainers to your question, but feel free to open a PR!

@colinrobertbrooks
Copy link

Is there a better way to update entry points?

const environment = require('./environment');
const config = environment.toWebpackConfig();
const oldEntry = config.entry;
const newEntry = {};

for(const key of Object.keys(oldEntry)) {
    newEntry[key] = [
      'react-hot-loader/patch',
      oldEntry[key]
    ];
};

config.entry = newEntry;

module.exports = config;

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

3 participants