Skip to content

Conversation

csc-felipe
Copy link
Contributor

@csc-felipe csc-felipe commented Feb 21, 2023

Description

vue-cli is not the recommended tool for vue projects any more, and migrating to vite is a step towards migrating to vue3.

Quite many changes were needed, but it looks like it works as before. Development workflows shouldn't be affected, as the pnpm commands are the same.

The most significant change for the project structure is that for a multipage app (with multiple HTML entries), the HTML files need to be declared specifically for each entry.

The biggest difference, as I understood, between both tools is the underlying bundler, and the dev server.

The bundler in vue-cli is webpack, while for vite it's rollup.

They claim that vite's dev server is superfast, but what it actually does is build dependencies on demand, so it looks faster to start, but while browsing some waiting usually follows. It might anyway be an improvement over vue-cli.

The browser compatibility is also supposed to be good enough, even without babel or autoprefixer:

  • Chrome >=87
  • Firefox >=78
  • Safari >=14
  • Edge >=88

Related issues

Type of change

  • New feature (non-breaking change which adds functionality)

Changes Made

  • Remove vue-cli and dependencies
  • Add vite and its dependencies
  • Migrate vue-cli config to vite config
  • Fix component imports, mostly adding .vue to the imports, which also makes type hinting work
  • Fix css import statements
  • Importing css styles in style blocks was changed to global "import" configured in vite.config.js
  • Created a middleware plugin for vite to serve the /browse page as an SPA, and the other html files as well
  • Add https configuration for the dev server

Testing

  • Tests do not apply

Please, check that the setup works as expected!

Mentions

@csc-felipe csc-felipe added the debt Technical debt label Feb 21, 2023
@csc-felipe csc-felipe self-assigned this Feb 21, 2023
@csc-felipe csc-felipe force-pushed the feature/vite branch 2 times, most recently from 3a6fcb0 to b4d1d11 Compare February 21, 2023 15:45
@blankdots
Copy link
Contributor

blankdots commented Feb 22, 2023

should we wait for #929 before, or when we have all the features before the release, before we proceed with this ?

@csc-felipe
Copy link
Contributor Author

should we wait for #929 before or when we have all the features before the release before we proceed with this ?

I think so

@hannyle
Copy link
Contributor

hannyle commented Feb 23, 2023

Looks good and it works as expected for me 👍

@csc-felipe
Copy link
Contributor Author

Rebased, and added github PR number to the changelog.

@csc-felipe csc-felipe requested a review from hannyle February 27, 2023 09:07
@csc-felipe
Copy link
Contributor Author

I'll mark it as WIP while we wait for other PR to be merged

@csc-felipe csc-felipe changed the title Migrate from vue-cli to vite WIP: Migrate from vue-cli to vite Feb 27, 2023
@csc-felipe
Copy link
Contributor Author

I've been developing off this branch, and the dev server doesn't work well with the current configuration.

@csc-felipe csc-felipe force-pushed the feature/vite branch 5 times, most recently from 5f2ec2d to b592d2c Compare March 13, 2023 12:49
@csc-felipe
Copy link
Contributor Author

rebased

@csc-felipe
Copy link
Contributor Author

rebased and added https mode for dev server

@csc-felipe
Copy link
Contributor Author

The devserver seems to behave well now.
The fix was to set the path to javascript file in the html files without a leading ..
Together with the middleware that serves the correct files.

I still need to test that websockets work, though.

@csc-felipe
Copy link
Contributor Author

websockets work

@csc-felipe csc-felipe force-pushed the feature/vite branch 2 times, most recently from 8f6b8cf to c0202c0 Compare March 14, 2023 13:40
@csc-felipe csc-felipe changed the title WIP: Migrate from vue-cli to vite Migrate from vue-cli to vite Mar 14, 2023
blankdots
blankdots previously approved these changes Mar 14, 2023
Copy link
Contributor

@blankdots blankdots left a comment

Choose a reason for hiding this comment

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

i personally do not spot anything at this time, was able to build and run it, however best to wait for other reviewers before merging

@hannyle
Copy link
Contributor

hannyle commented Mar 15, 2023

Worked well for me in most of the pages, some exceptions are for pages such as /unauth/, /forbid, /uidown which redirected me to index.html, I think.

@csc-felipe
Copy link
Contributor Author

@hannyle, it should be fixed now

@csc-felipe csc-felipe mentioned this pull request Mar 16, 2023
3 tasks
sampsapenna
sampsapenna previously approved these changes Mar 17, 2023
Copy link
Member

@sampsapenna sampsapenna left a comment

Choose a reason for hiding this comment

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

Works nicely, Vite seems considerably quicker in the hot-reloads of files. Took a bit of getting used to the files not getting built initially, though.

Approved, everything seems to work 👌🏼

blankdots
blankdots previously approved these changes Mar 17, 2023
hannyle
hannyle previously approved these changes Mar 17, 2023
@csc-felipe csc-felipe dismissed stale reviews from hannyle, blankdots, and sampsapenna via 461c039 March 17, 2023 11:16
@csc-felipe csc-felipe changed the base branch from devel to feature/dump-buefy March 17, 2023 11:17
Base automatically changed from feature/dump-buefy to devel March 20, 2023 08:36
@csc-felipe csc-felipe merged commit 6332c72 into devel Mar 20, 2023
@csc-felipe csc-felipe deleted the feature/vite branch March 20, 2023 08:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
debt Technical debt
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants