-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Feature Request: Debug Support, print webpack config #2161
Comments
This might be of interest: #1916
// run with `node ./this_file.js`
// This file MUST be in the base directory (wherever package.json is)
const util = require('util')
const ConfigObject = require("./node_modules/@rails/webpacker/package/environments/production.js"); // or whatever
const output = new ConfigObject();
//console.log(util.inspect(output, false, null, true));
console.log(util.inspect(output.toWebpackConfig(), false, null, true));
You can also interactively debug node from chrome's dev tools. |
It does, as a matter-of-fact. My option above uses the same util.inspect line however as a rails/ruby guy there was a wasted 20 min looking up why regular expressions were not being serialized, then another effort to figure out the depth of the inspect, and then another one hooking into the webpacker hooks and then developing my own plugin to support the dumping AFTER ALL config files were processed regardless of if we were in dev/test/prod. I really like the idea of moving away from a "magic" config and instead dumping a template generator file for a default config. #1916. I think the obvious tradeoff there is that you have to expose people to all the crap associated with webpack configs (however I think its going to happen anyway since thats the tool DHH decided to use for rails JS assets anyway). Seems odd to try and hide it when we need to dig into it anyway. |
This is exactly the sentiment that I have been expressing: #1938 (comment). I stopped using webpacker a long time ago but stick around to "hold the door open" for others. I hope to slowly resolve the pain points that both new & power users experience (and eventually move back to webpacker).
I would argue that webpack has better documentation and is better suited to handle this.
Ideally, you could pass a static config to webpackER, but WDS will give you problems since it is Rails that handles the proxy. Right now, it is just a matter of learning how users want & expect to use webpacker. Issues like this really help with that. |
Taking #2161 (comment) a step further, to debug your own customised config: debug_webpacker.js (in the root of your project) const util = require('util');
const output = require("./config/webpack/development.js");
console.log(util.inspect(output, false, null, true)); And then run: |
@jackocnr Yes, I do something similar except with console.dir(require('./config/webpack/development'), { depth: null }) |
Yeah, please add an easier debugging option! 👍 Also setting |
With Webpacker 6, it's easier to see the config. But this comment is the way to go for now. Feel free to reopen if needed. |
Hey Guys,
Can we please add a way to print/dump the entire webpack config easily.
The naive things don't work particularly well:
All I want is the ability to plainly see the state of the webpack config as its configured by webpacker without having to do something like this:
My goal in all of this was trying to determine what the END state AFTER all config files had been processed what my module and rules were.
The text was updated successfully, but these errors were encountered: