Skip to content

refactor: imports #3299

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

Merged
merged 5 commits into from
May 15, 2021
Merged

refactor: imports #3299

merged 5 commits into from
May 15, 2021

Conversation

snitin315
Copy link
Member

  • This is a bugfix
  • This is a feature
  • This is a code refactor
  • This is a test update
  • This is a docs update
  • This is a metadata update

For Bugs and Features; did you add new tests?

No, Already present.

Motivation / Use-Case

Reduce import at startup.

Breaking Changes

None

Additional Info

No

@@ -980,6 +985,9 @@ class Server {
}

serveMagicHtml(req, res, next) {
const getFilenameFromUrl =
require('webpack-dev-middleware/dist/utils/getFilenameFromUrl').default;
Copy link
Member

Choose a reason for hiding this comment

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

I think we should add this method to public webpack-dev-middleware API here https://github.com/webpack/webpack-dev-middleware/blob/master/src/index.js#L78, in future we should avoid import non public API

Copy link
Member Author

Choose a reason for hiding this comment

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

Makes sense, will do 👍🏻

@codecov
Copy link

codecov bot commented May 15, 2021

Codecov Report

Merging #3299 (7db6b90) into master (670966f) will increase coverage by 0.16%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #3299      +/-   ##
==========================================
+ Coverage   95.40%   95.56%   +0.16%     
==========================================
  Files          34       34              
  Lines        1241     1241              
  Branches      354      354              
==========================================
+ Hits         1184     1186       +2     
  Misses         51       51              
+ Partials        6        4       -2     
Impacted Files Coverage Δ
lib/Server.js 95.82% <100.00%> (+0.39%) ⬆️

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 670966f...7db6b90. Read the comment docs.

@snitin315 snitin315 marked this pull request as ready for review May 15, 2021 13:31
Copy link
Member

@anshumanv anshumanv left a comment

Choose a reason for hiding this comment

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

👍

@snitin315 snitin315 changed the title refactor: imports [WIP] refactor: imports May 15, 2021
const fs = require('graceful-fs');
const ipaddr = require('ipaddr.js');
const internalIp = require('internal-ip');
const killable = require('killable');
const chokidar = require('chokidar');
const express = require('express');
Copy link
Member

Choose a reason for hiding this comment

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

I think in future we reduce them more, good right now

Comment on lines +547 to +548
const https = require('https');
const http = require('http');
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure it'd make a difference, but I think we can move these below just like require('spdy').

Copy link
Member

Choose a reason for hiding this comment

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

Feel free to send PR

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

Successfully merging this pull request may close these issues.

4 participants