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

feat: make optimization and splitChunks configurable #3060

Merged
merged 11 commits into from
Mar 20, 2018
Merged

Conversation

pi0
Copy link
Member

@pi0 pi0 commented Mar 19, 2018

As a continuation to previous works on splitPages, this PR makes both optimization (webpack 4 option) and splitChunks fully customizable.

We can disable all splitting features using this option in nuxt.config.js:

build: {
    optimization: {
      splitChunks: {
        chunks: 'async',
      }
    },
    splitChunks: {
      pages: false,
      vendor: false,
      commons: false,
      runtime: false,
      layouts: false
    },
}

Other improvements with this PR

  • Splitting for layout chunks disabled by default for performance
  • shouldPrefetch is falsy by default to improve TTL
  • resourcHints are disabled for dev mode

SPA Improvements

  • Support render.shouldPrefetch and render.shouldPreload
  • Disabled loadingIndicator to improve TTL
  • Runtime chunk is inlined only for production

@pi0 pi0 requested review from atinux and clarkdo March 19, 2018 18:43
@pi0 pi0 mentioned this pull request Mar 19, 2018
@codecov-io
Copy link

codecov-io commented Mar 19, 2018

Codecov Report

Merging #3060 into dev will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@         Coverage Diff          @@
##            dev   #3060   +/-   ##
====================================
  Coverage   100%    100%           
====================================
  Files         4       4           
  Lines        19      19           
  Branches      2       2           
====================================
  Hits         19      19

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 f57096e...cc336c4. Read the comment docs.

@@ -6,7 +6,8 @@ export default class Browser {
this.browser = await puppeteer.launch(
Object.assign(
{
args: ['--no-sandbox', '--disable-setuid-sandbox']
args: ['--no-sandbox', '--disable-setuid-sandbox'],
executablePath: process.env.PUPPETEER_EXECUTABLE_PATH
Copy link
Member Author

@pi0 pi0 Mar 20, 2018

Choose a reason for hiding this comment

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

Useful when locally debugging without the need to download puppeteer:

export PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=1

yarn install

# For macOS
export PUPPETEER_EXECUTABLE_PATH="/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"

We may also use this to speed up CI's setup stage by pre-downloading chrome...

@atinux atinux merged commit d1d637f into dev Mar 20, 2018
@pi0 pi0 deleted the feat/asyncChunks branch March 20, 2018 12:33
@clarkdo
Copy link
Member

clarkdo commented Aug 31, 2018

NOTE: puppeteer/puppeteer#3071

@pi0
Copy link
Member Author

pi0 commented Sep 1, 2018

Thanks @Clark 😁👌

@lock
Copy link

lock bot commented Oct 31, 2018

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Oct 31, 2018
@danielroe danielroe added the 2.x label Jan 18, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants