Skip to content

feat(webpack-dev-server): add WEBPACK_DEV_SERVER environment variable#1533

Closed
donaldpipowitch wants to merge 1 commit into
webpack:masterfrom
donaldpipowitch:patch-2
Closed

feat(webpack-dev-server): add WEBPACK_DEV_SERVER environment variable#1533
donaldpipowitch wants to merge 1 commit into
webpack:masterfrom
donaldpipowitch:patch-2

Conversation

@donaldpipowitch

@donaldpipowitch donaldpipowitch commented Oct 18, 2018

Copy link
Copy Markdown
  • This is a bugfix
  • This is a code refactor
  • This is a test update
  • This is a typo fix
  • This is a metadata update
  • This is a feature ← It looks like this is missing in the template? ⚠️

For Bugs and Features; did you add new tests?

No. I just added it in the same way webpack-serve did it and they had no test for this either 🤔As this was an official package before I assume it's okay for this one as well?

Motivation / Use-Case

As described here: #1532.

Breaking Changes

No.

Additional Info

I placed this just before require('webpack-cli/bin/convert-argv') which will require my config and this env variable should be visible for the config file.

👋

@codecov

codecov Bot commented Oct 18, 2018

Copy link
Copy Markdown

Codecov Report

Merging #1533 into master will decrease coverage by 13.87%.
The diff coverage is 100%.

Impacted file tree graph

@@             Coverage Diff             @@
##           master    #1533       +/-   ##
===========================================
- Coverage   89.19%   75.32%   -13.88%     
===========================================
  Files           9       10        +1     
  Lines         611      689       +78     
  Branches      186        0      -186     
===========================================
- Hits          545      519       -26     
- Misses         54      170      +116     
+ Partials       12        0       -12
Impacted Files Coverage Δ
lib/Server.js 81.81% <100%> (-3.51%) ⬇️
bin/webpack-dev-server.js 58.52% <100%> (ø)
lib/utils/createLogger.js 87.5% <0%> (-12.5%) ⬇️
lib/utils/addEntries.js 100% <0%> (ø) ⬆️
lib/utils/createCertificate.js 100% <0%> (ø) ⬆️
lib/utils/createDomain.js 100% <0%> (ø) ⬆️
lib/utils/updateCompiler.js
lib/utils/defaultTo.js
lib/utils/findPort.js
... and 6 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4c52153...70e2600. Read the comment docs.

@alexander-akait alexander-akait left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not right place, we should set WEBPACK_DEV_SERVER when you run using node api too, your code set env var only when you run dev server using cli. Here right place https://github.com/webpack/webpack-dev-server/blob/master/lib/Server.js#L60

@donaldpipowitch

Copy link
Copy Markdown
Author

Then I'd set it in both places, because new Server is called too late, if I use the CLI API, if I'm not mistaken. The custom config file would already be required at that stage.

@alexander-akait

Copy link
Copy Markdown
Member

@donaldpipowitch too late? Can you describe where it is late?

@alexander-akait

Copy link
Copy Markdown
Member

Also need add tests to avoid regressions in future

@donaldpipowitch

donaldpipowitch commented Oct 18, 2018

Copy link
Copy Markdown
Author

Can you describe where it is late?

We need this env var, before the webpack.config.js is required. If I'm not mistaken this happens before new Server() in case of the CLI.

@alexander-akait

alexander-akait commented Oct 18, 2018

Copy link
Copy Markdown
Member

@donaldpipowitch looks you right, please add test, also fix lint problem

@michael-ciniawsky michael-ciniawsky changed the title fixes #1532 - set WEBPACK_DEV_SERVER env var feat(webpack-dev-server): add support for WEBPACK_DEV_SERVER env var Oct 18, 2018
@donaldpipowitch

Copy link
Copy Markdown
Author

Added lint fix and a small test. 👍

@alexander-akait alexander-akait left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need test for Server too

@donaldpipowitch

Copy link
Copy Markdown
Author

I wasn't sure where I should put that test, so I created a new file. Hope that's fine?

@alexander-akait

Copy link
Copy Markdown
Member

Hm, CI tests on windows broken 😕 Not related to this PR

@michael-ciniawsky michael-ciniawsky changed the title feat(webpack-dev-server): add support for WEBPACK_DEV_SERVER env var feat(webpack-dev-server): add WEBPACK_DEV_SERVER environment variable Oct 23, 2018
@donaldpipowitch

Copy link
Copy Markdown
Author

Anything more I can do? :) Thanks so far.

@michael-ciniawsky

Copy link
Copy Markdown
Contributor

@donaldpipowitch

Copy link
Copy Markdown
Author

Is this a failure on my side? 🤔 Hard to tell for me. Should I rebaserebase with the current master?

@hiroppy

hiroppy commented Apr 29, 2019

Copy link
Copy Markdown
Contributor

@donaldpipowitch Could you rebase? If you don't rebase I will take over.

@donaldpipowitch

Copy link
Copy Markdown
Author

I tried to update it. If it doesn't work, I'd be happy if you could move on with the MR.

@hiroppy

hiroppy commented May 12, 2019

Copy link
Copy Markdown
Contributor

@donaldpipowitch Sorry but could you rebase again? We dropped travis and appveyor.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants