Skip to content
This repository has been archived by the owner on Jan 4, 2023. It is now read-only.

feat: production build with vite #179

Merged
merged 26 commits into from
Aug 24, 2021
Merged

feat: production build with vite #179

merged 26 commits into from
Aug 24, 2021

Conversation

antfu
Copy link
Member

@antfu antfu commented Aug 20, 2021

This PR introduces the ability to run nuxt build use Vite, resolve #167. close #7

This also made Nuxt 2 working with vite plugins, tested with https://github.com/antfu/vitesse-nuxt/tree/play/vite-build

The build is disable by default, and can be enabled with:

// nuxt.config
export default {
  buildModules: [
    'nuxt-vite'
  ],
  vite: {
    build: true
  }
}

Ideally we would like to make it default to true, but do we want to release is as opt-in experimental feature and change it in the future (or we have it default to true and releases with beta dist?) /cc @pi0 @atinux WDYT?

This should be released as a minor change.

@codecov-commenter
Copy link

codecov-commenter commented Aug 20, 2021

Codecov Report

Merging #179 (d3070c6) into main (f0044db) will decrease coverage by 13.71%.
The diff coverage is 52.32%.

Impacted file tree graph

@@             Coverage Diff             @@
##             main     #179       +/-   ##
===========================================
- Coverage   90.16%   76.44%   -13.72%     
===========================================
  Files          11       11               
  Lines         183      242       +59     
  Branches       43       53       +10     
===========================================
+ Hits          165      185       +20     
- Misses         18       57       +39     
Impacted Files Coverage Δ
test/fixture/nuxt.config.js 100.00% <ø> (ø)
src/client.ts 91.30% <33.33%> (-8.70%) ⬇️
src/server.ts 56.84% <48.00%> (-33.41%) ⬇️
src/index.ts 73.17% <100.00%> (+0.67%) ⬆️
src/utils/wpfs.ts 100.00% <100.00%> (ø)
src/vite.ts 95.45% <100.00%> (+0.21%) ⬆️

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 f0044db...d3070c6. Read the comment docs.

@antfu antfu requested a review from pi0 August 20, 2021 08:21
@antfu
Copy link
Member Author

antfu commented Aug 20, 2021

For testing, do you think we should introduce cypress for e2e test?

src/server.ts Outdated Show resolved Hide resolved
docs/content/en/1.getting-started/3.build.md Outdated Show resolved Hide resolved
src/server.ts Outdated Show resolved Hide resolved
src/server.ts Outdated Show resolved Hide resolved
src/server.ts Outdated Show resolved Hide resolved
@pi0
Copy link
Member

pi0 commented Aug 24, 2021

It seems we have a hydration error with fixture production build: (still reproducable but checking later)

image

@pi0 pi0 changed the title feat: ssr build with Vite feat: production build with vite Aug 24, 2021
@pi0 pi0 merged commit 19bf4b2 into main Aug 24, 2021
@pi0 pi0 deleted the antfu/vite-build branch August 24, 2021 13:46
'nuxt-vite'
],
vite: {
build: true
Copy link
Member Author

Choose a reason for hiding this comment

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

@pi0 Should we make it default to true and for users to opt-out? Or maybe in next breaking?

Copy link
Member

@pi0 pi0 Aug 24, 2021

Choose a reason for hiding this comment

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

I vote for next major (0.3.x) so that we can fix leftover issues like modern mode mapping, speeding up and better legacy.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Build Nuxt project with Vite instead of Webpack fix: support asset importing (ssr)
5 participants