Skip to content

Add config.cache example to webpack.local-config.js note#4446

Merged
julienw merged 2 commits into
firefox-devtools:mainfrom
kazarmy:config.cache
Jan 26, 2023
Merged

Add config.cache example to webpack.local-config.js note#4446
julienw merged 2 commits into
firefox-devtools:mainfrom
kazarmy:config.cache

Conversation

@kazarmy

@kazarmy kazarmy commented Jan 26, 2023

Copy link
Copy Markdown
Contributor

This pr adds a config.cache example to the webpack.local-config.js note in CONTRIBUTING.md, and so now both parameters are being used. This is probably the last change that I want to make to the note.


Some side notes:

  • I profiled the uncached webpack build, terminating the server with the code below. It seems that babel transformations take up a large chunk of the time.
module.exports = function (config, serverConfig) {
  serverConfig.setupMiddlewares = (middlewares, _devServer) => {
    let attachedOpen = false;
    for (const m of middlewares) {
      if (m.name === 'webpack-dev-middleware' && !attachedOpen) {
        m.middleware.waitUntilValid(() => {
          process.kill(process.pid, 'SIGINT');
        });
        attachedOpen = true;
      }
    }
    return middlewares;
  };
};
  • With the (cached) build at sub-10 seconds, I had a better user experience with opening the browser tab in parallel with the build, rather than opening it after the build.

@codecov

codecov Bot commented Jan 26, 2023

Copy link
Copy Markdown

Codecov Report

Base: 88.55% // Head: 88.55% // No change to project coverage 👍

Coverage data is based on head (97f8244) compared to base (b5b2ec2).
Patch has no changes to coverable lines.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4446   +/-   ##
=======================================
  Coverage   88.55%   88.55%           
=======================================
  Files         283      283           
  Lines       25533    25533           
  Branches     6879     6879           
=======================================
  Hits        22611    22611           
  Misses       2715     2715           
  Partials      207      207           

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@julienw

julienw commented Jan 26, 2023

Copy link
Copy Markdown
Contributor

Thanks! Usually I keep the webpack server running in background all the time, so I don't get this first-build penalty often. It's also why I usually don't use this behavior of opening a tab automatically.

Maybe one day we'll switch to some other tooling such as vite that's faster and has a working HMR setup...

Comment thread CONTRIBUTING.md
Comment on lines +51 to +53
config.cache = {
type: 'filesystem',
};

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Mmm I wonder if we should have this by default in our config actually. It looks like I considered doing this because I have an open tab on this configuration.
It would be good to get your feedback after a few days using this.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I currently do plan to find out whether server config changes force a full rebuild, but what is next isn't yet set in stone.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Modifying serverConfig.static roughly triples the cached webpack build time lol

@julienw julienw left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

thx!

@julienw julienw merged commit d49ab25 into firefox-devtools:main Jan 26, 2023
@kazarmy

kazarmy commented Jan 26, 2023

Copy link
Copy Markdown
Contributor Author

Usually I keep the webpack server running in background all the time, so I don't get this first-build penalty often.

I can't justify leaving my laptop on power and unattended, and hibernating it isn't 100% reliable.

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.

2 participants