Skip to content
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

Update webpack + pack mode #189

Merged
merged 6 commits into from
Dec 21, 2018
Merged

Conversation

sokra
Copy link
Member

@sokra sokra commented Dec 21, 2018

  • update webpack (for performance fixes)
  • close the compiler even in case of errors
  • switch to pack store mode (better performance)
  • externals signature changed in v5

@codecov-io
Copy link

codecov-io commented Dec 21, 2018

Codecov Report

Merging #189 into master will increase coverage by 0.05%.
The diff coverage is 75%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master    #189      +/-   ##
=========================================
+ Coverage   67.65%   67.7%   +0.05%     
=========================================
  Files          12      12              
  Lines         575     576       +1     
=========================================
+ Hits          389     390       +1     
  Misses        186     186
Impacted Files Coverage Δ
src/index.js 70.24% <75%> (+0.24%) ⬆️

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 373f5f1...d88af64. Read the comment docs.

@@ -54,8 +54,7 @@ module.exports = (
type: "filesystem",
cacheDirectory: typeof cache === 'string' ? cache : nccCacheDir,
name: "ncc",
version: require('../package.json').version,
store: "instant"
Copy link
Contributor

Choose a reason for hiding this comment

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

If switching to the pack mode, should we also now ensure that the cache is a per-project cache in the node_modules folder instead of the single global cache?

Copy link
Member Author

Choose a reason for hiding this comment

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

That would make sense.

Another option is to keep the cache location, but use a different cache.name for each directory.

Like this: name: hashOf(directory)

Copy link
Contributor

Choose a reason for hiding this comment

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

The risk with the global cache with this new storage seems to be disk usage growth right?

I guess this can be mitigated with a simple eviction strategy in due course. But that was another argument for per-project caching.

The argument for global caching is that ideally it would be great if the global cache could be smart enough to know the hashes of the dependencies (yarn.lock again!), and thus share compilations.

Not sure which of the above you want to shoot for here, but will trust your judgement!

Copy link
Member Author

Choose a reason for hiding this comment

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

The per-project cache is garbage-collected, so disk usage should increase only with the number of different entries used on a computer.

name: "ncc",
version: require('../package.json').version,
store: "instant"
name: `ncc_${hashOf(entry)}`,
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this not be a hash of the project directory, so that if the input changes the cache can still be used?

Copy link
Member Author

Choose a reason for hiding this comment

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

I've thought about that, but decided against it.

This could be a problem when using ncc for multiple entries in a single directory. They would override the cached generated output files in the cache. This would slow down the rebuilds when switching between these these entries.

This configuration provides consistent fast rebuilds at the cost of high initial build for each entry.

But choosing the other way is also a valid trade-off. I assumed # of rebuilds >> # of initial builds and people may run ncc for multiple entries in parallel.

@rauchg rauchg merged commit fc3ecef into vercel:master Dec 21, 2018
@sokra sokra deleted the update/webpack-pack-mode branch December 21, 2018 17:00
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