aurelia / cli

The Aurelia 1 command line tool. Use the CLI to create projects, scaffold components, and bundle your app for release.
MIT License
407 stars 133 forks source link

Webpack devServer options ignored when using au run #794

Open NightWulfe opened 6 years ago

NightWulfe commented 6 years ago

I'm submitting a feature request

Please tell us about your environment:

Current behavior: Setting proxy, or other devServer configuration options, in webpack.config.json is ignored when using au run. This is because the run task (tasks/run.ts) creates its own options object and uses that.

After looking at the run task (tasks/run.ts), I saw that it creates its own server options and completely ignores the options in webpack, using an opts object it creates in the task. After setting my proxy configuration there in run.ts, the proxy works fine.

AshleyGrant commented 6 years ago

I'm not sure if this behavior should be changed. Users familiar with webpack will likely want to completely remove themselves from the aurelia cli environment, and so we might not want to give preference to options in that file.

What we might want to do, though, is look at moving the webpack config file in to the aurelia_project folder.

Alexander-Taran commented 6 years ago

Alternative solution: a nice commented webpack.config.js file where it is clearly stated that options would be set via cli if used.. so the tinkering kind will know better.

sirudog commented 5 years ago

I agree with @NightWulfe. I just bumped into the same issue. Then I found this issue, so I went to check the aurelia docs here: https://aurelia.io/docs/cli/basics#webpack-vs-built-in-bundler

This section especially suggests that if you need to customize your config, the webpack.config is the place to do that: Webpack is a bundler with built-in module loader. If you choose to use Webpack then you don't need a separate module loader. Webpack is powerful and popular, but it could be a daunting task to set up Webpack from scratch. Aurelia CLI generates a battle-tested Webpack configuration file for your app, provides a solid base for further customization if you ever need to.

So if this behaviour will not be changed, at least the docs should be clear on when webpack-dev-server config is used/ignored.

3cp commented 5 years ago

Although I don't use webpack, I agree overwriting webpack config in run task is difficult for me to follow.

BTW, I wrote that newly updated piece of doc for webpack, without really understand the whole setup. The doc needs to be updated to describe how we control webpack config.

ivanbacher commented 5 years ago

Seems to be working now.

3cp commented 5 years ago

There is a fix #1088 merged but not released.