madskristensen / WebPackTaskRunner

A Visual Studio extension
Other
39 stars 16 forks source link

Incorrect command line: --colors option does not exist #14

Closed crbranch closed 8 years ago

crbranch commented 8 years ago

With webpack 2.0.5-beta installed, executing "Run - Development" or "Run - Production" tasks causes webpack to display an error message: Unknown argument: colors

> cmd /c SET NODE_ENV=development&& webpack -d --colors

should be

> cmd /c SET NODE_ENV=development&& webpack -d --color
scottaddie commented 8 years ago

@crbranch It looks like this CLI option was changed back on January 20th. See the offending commit in bin/webpack.js here. I'm researching this to determine why the rename occurred. The --colors switch does work with the latest release of Webpack 1.x, so only 2.x is impacted. I'll let you know what I find out.

scottaddie commented 8 years ago

To provide an update, it looks like the supports-color module was added to Webpack as a dependency back on 2/5/2015. It's that module in particular that expects the --color and --no-color switches to be used for toggling the coloring. I've successfully tested the --color switch in the Webpack 1.x branch from 1.12.12 all the way back to 1.10.5, and I suspect that it's supported even further back than that version. I'll work on a commit for this and hope to have it ready tonight or early tomorrow. At that point, you could test this using the nightly build link for the extension.

crbranch commented 8 years ago

@scottaddie Thanks for investigating and working on a fix. I appreciate it! One suggestion, if feasible, would be to move the webpack command line(s) out of the C# code to a config file or somewhere that is more easily accessible in case webpack options change again in the future. I'm not sure if VS plugins have config files, but if this had been in a config file, I could have potentially made the change myself. Just a thought.

madskristensen commented 8 years ago

Interesting idea. Perhaps put a JSON file in the %UserProfile% called webpackvs.json or something like that. We can then add a button to the Solution Explorer context menu when you right-click on webpack.config.js that will open the JSON file for editing

scottaddie commented 8 years ago

I really like this idea as well. Webpack options are sure to break/change with the final release of Webpack 2. For example, the --bail switch will be enabled by default.

scottaddie commented 8 years ago

@crbranch The fix for this issue has been committed. Feel free to install the latest version of the extension via the "nightly build" link found on the README page.

crbranch commented 8 years ago

@scottaddie I can confirm the latest version of Webpack Task Runner (1.4.53) fixes the issue. Thanks again for your help, and the quick turnaround!

scottaddie commented 8 years ago

@crbranch Thank you for reporting the issue and for testing the fix! I'll work with Mads to see if we can make your awesome config file idea a reality.