-
Notifications
You must be signed in to change notification settings - Fork 71
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
Introduce vite #390
Introduce vite #390
Conversation
dccb0cf
to
b002e36
Compare
import {babel} from './viteConfig/babelConfig'; | ||
|
||
// https://vite.dev/config/ | ||
export default defineConfig(({mode}) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
question:
all that rules from webpack works with vite out of the box?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good question. Some rules were migrated/not migrated by the considerations below.
- Focus on the migration to make the client app work just right (without losing developing experience and breaking the app)
- Some are not migrated since webpack rules has less benefits than vite default configuration
- For some rules require more efforts whilst produce little benefits, they are decided not to migrate
I've worked a few crucial steps during vite migration:
- Define
__POINZ_CONFIG__
as global variable based ondevelopment
orproduction
build. - Copy dev server proxy paths to vite config.
- Change dev server default port to
9000
to make sure development experience unchanged.
Rules were not migrated:
- Production build analysis is removed. Do we ever use this analysis regularly or as metrics before deployment? If yes I can introduce a vite alternative of analyzer.
- polyfill to fetch
whatwg-fetch
is removed. Personally I don't think we should still support IE. What do you think? - webpack
url-loader
transforms images less than limit to base64 otherwise leaves as plain url. With vite, it packs files to assets anyway. I don't think it's a big difference since we have fixed numbers of assets anyway.
- The bundled assets are hashed in different way (See
legacy-deploy
as build with webpack anddeploy
folder using vite). Personally I think vite has more benefits with file names and hash than fully hashed.
7728464
to
067903c
Compare
Resolve #384
Context: Vite introduction is a big task. It requires big change in client folder on adapting vite ecosystem with minimal changes to js source files to preserve similar feature in development experience & building.
Things to consider:
styled-components
in issue Move from styled-components to tailwind #383 )data-testid
attribute (Can be achieved by introducing plugins mentioned in vite discussion remove data-attribute in production vitejs/vite#10408)