Wegue v3.x transited from Vue 2 to Vue 3, from Vuetify 2 to Vuetify 3 and from Vue-CLI to Vite which implies a lot of changes.
Wegue team tried to introduce as few changes as possible to make the transition as smooth as it can be.
This means components are still written using the Options API for example.
To be compatible with all the required dependencies, minimal node version was raised to v20.19.0 while minimal npm version was also raised to v10.8.2.
Changes that were applied on the files present in the app-starter directory should also be applied to your custom files present in the app directory.
Pay particular attention to these three points:
- The
app/staticdirectory should be renamedapp/public/static - The
app/static/cssdirectory should be renamedapp/styles - A file named
app/styles/vuetify-settings.scssmust be present. The default minimal file can be found in theapp-starter/stylesdirectory.
For more details about its usage, please refer to the Wegue documentation.
Vue-CLI toolchain was replaced by Vite which means Webpack is replaced by esbuild and Rollup behind the scenes which implies a lot of changes in the code and in the configuration files.
Comparing changes applied on the components present in the app-starter directory and looking at the vite.config.js in the root folder should give you a good overview of what has to be done.
To have a broader view of the changes implied, you can also refer to the how to migrate from Vue-CLI to Vite article published on VueSchool website.
Here is a list of the essentials which had to be adapted in the Wegue code regarding to Vite adoption:
- Transpiling using
Babelwas removed, as support for legacy browsers. Configuration files such asbabel.config.jsand.browserlistrchave been removed. If this was important in your custom app, you can try and install the official Vite legacy plugin which will allow you to reintroduce transpiling and polyfilling during the build step. vue.config.jsfile is now replaced byvite.config.js. Contents and syntax are completely different though so if you had to tune this file for your needs, please refer to the Configuring Vite official page to find what has to be done.- Assets management works differently in
Vite. However, by renaming theapp/statictoapp/public/static, this should be transparent without adapting anything.
In some edge cases it is possible that the path used to reference a static file should be changed and written as an absolute path as explained inside Static Asset Handling on theViteguide page. - The command used to run the dev build is now
npm run dev. - A new
npm run previewcommand was added which can be used to preview your build locally before uploading it to a server. - The main
HTMLtemplate files which were present in thepublicsubfolder are now in the root directory of your project. Please adapt them to the needs of yourWegueapplication. Vue-CLIwas making use ofhtml-webpack-pluginto amend the mainHTMLtemplate files during build. This kind of functionality is not included by default insideVite.
If you were using some of these advanced functionalities and would like to keep something similar while migrating, you should consider installing and configuring a specific plugin such as vite-plugin-html.- If you used custom environment variables that needed to be present inside the produced bundle, you have to rename them so they start with
VITE_instead ofVUE_APP_. - As strongly recommended in Vite official docs,
.vuefiles are not resolved anymore if the extension is omitted insideimportstatements. You should adapt all your components and unit tests or add.vuein theresolve.extensionsconfig option in yourvite.config.jsfile.
Vue was upgraded from v2.x to v3.x which implies a lot of breaking changes. Please refer to the official Vue 3 Migration Guide, especially its Breaking Changes part when you upgrade your Wegue app.
Comparing changes applied on the components present in the app-starter directory should give you a good overview of what has to be done.
Here is a list of the essentials which had to be adapted in the Wegue code regarding to the upgrade of Vue to version 3.x:
-
<template v-for>keyattribute should be placed on the<template>tag now rather than on its children. -
Vuenow has a concept of app instance which completely changes how global configuration can be approached. Some variables that were stored on theVueprototype are now reachable from the app instance throughthisinside components.
For example, theapplication configurationwhich was available throughVue.prototype.$appConfigcan now be accessed usingthis.$appConfig.
The same applies to$appLanguageand$isEmbedded.
There is a limitation though as accessing the app instance is only possible inside components, not from plainJavaScriptfiles. -
For the same reason,
ViewAnimationUtilhelper functions are now embedded inside a class with the known limitation that it can only be used inside of components.
Some changes must be done if you were using those functions directly inside your application.
Something previously written like this:ViewAnimationUtil.to(this.map.getView(), foundFeature.getGeometry());Should be replaced by:
const viewAnimationUtil = new ViewAnimationUtil(this.$appConfig.viewAnimation);
viewAnimationUtil.to(this.map.getView(), foundFeature.getGeometry()); -
Vueinstances can no longer be used to create an event bus.WguEventBuswas rewritten to make use oftiny-emitterbecause of that. This should be fully transparent, however, some edge cases could be encountered if very specific usage is made of it. -
ColorTheme mixinandMapable mixinwere rewritten ascomposables. What should be done to migrate thosemixinsto theircomposablecounterparts is easier to see by example. Please take a look at the ThemeSwitcher component and the BackgroundLayerSwitcher component respectively.
For basic usage, migrating from theColorTheme mixinshould be limited to removing themixinregistration and adding the following two lines inside thesetup lifecycle hook:const { isDarkTheme, isPrimaryDark } = useColorTheme();
return { isDarkTheme, isPrimaryDark };For basic usage, migrating from the
Mapable mixinshould be limited to removing themixinregistration, removing the layers retrieval inside theonMapBoundmethod and adding the following two lines inside thesetup lifecycle hook:const { map, layers } = useMap();
return { map, layers };Please also note that
onMapBoundandonMapUnboundare not fired anymore. If you'd like to work with them as before, you have to implement your ownwatcheron themapfor that. You can refer to the OverviewMapPanel component to get a full example. -
portal-vueplugin has been replaced by the inbuilt Vue3 feature Teleport. The anchor element in the AppTemplate is now adivwith the idwgu-map-teleportand the syntax to hook up a teleport template has slightly changed:<template> <teleport to="#wgu-map-teleport"> <!-- content goes here --> </teleport> </template>
Currently, the Vue migration build is used instead of the native Vue 3 build. Because of this, usage of features that have changed or been deprecated in Vue 3 will emit runtime warnings. This can be really useful while migrating an application and ensure everything was dealt with properly.
Vue migration build compatibility with Vue 2 can be configured to suit your needs during the migration phase.
Global configuration is made inside the main.js file.
Options which are compiler-specific can be configured inside the vite.config.js file.
To get more information about this build and how to configure it, please refer to the official Vue 3 Migration Guide.
Usage of the Vue migration build will be removed for official Wegue v3 release.
Vuetify was upgraded from v2.x to v3.x which implies a lot of breaking changes. Please refer to the official Vuetify 3 Upgrade Guide when you upgrade your Wegue app.
Comparing changes applied on the components present in the app-starter directory should give you a good overview of what has to be done. There were so many changes in the APIs though that each component should be addressed separately. This will certainly be the most tedious part of migrating a complete Wegue app.
Here is a list of the essentials which had to be adapted in the Wegue code regarding to the upgrade of Vuetify to version 3.x:
Material Iconsnow need themd:prefix added to their name. For example,chevron_leftis now calledmd:chevron_left.
MDIkeep their name unchanged. For example,mdi-menu-lefthas still the same name.
Please update icon names accordingly inside your app code and inside your configuration files.onprimaryandonsecondarycolors are now calledon-primaryandon-secondaryrespectively. Please update your configuration files accordingly.
Take also note that theaccentandanchorcolors were removed while some others such assurfacehave been added by default. You can refer to the official Theme configuration page for more information. Also keep in mind that you can still create custom colors and are not limited to the standard ones.- Custom icons format has slightly changed, their definition should now begin with
svg:and they can be referenced using$myIconName.
For example, an icon which was defined asexport default 'M 23.16738,3.1894921 18.478314,20.810508 H ... L 20.847525,3.1894921 Z'should now de defined asexport default 'svg:M 23.16738,3.1894921 18.478314,20.810508 H ... L 20.847525,3.1894921 Z'. If this was defined inside a file calledapp/custom-icons/WLetter.js, it was displayed using$vuetify.icons.WLetteras a name. If the file name hasn't changed, it is now displayable using$WLetteras a name.
Please update your app code and configuration files accordingly.
The MDI icon library was upgraded to its current latest version.
Please refer to the official changelog for versions later than 7.2.96 and check if you are using updated icons. These have changed visually and may impact the appearance of your Wegue application.
The material-icons icon library was replaced by @material-design-icons which is a lighter version of the previously used one. The available icons set is exactly the same but only the woff2 format is included.
Current pinned versions are the following:
@mdi/font=> 7.4.47@material-design-icons/font=> 0.14.15
ESLint and its associated plugins were upgraded to the following versions:
eslint=> 9.36.xeslint-plugin-vue=> 10.5.xeslint-plugin-vuetify=> 2.5.x@eslint/js=> 9.36.x@vue/eslint-config-standard=> 9.0.x
Many breaking changes are implied because of this upgrade. Please refer to the official ESLint migration guide when you upgrade your Wegue app.
Here are the two essential things which had to be adapted in the Wegue code regarding to the upgrade of ESLint to version 9.x:
- The configuration file format has completely changed and now uses what is called the
flat configformat. If you used a custom configuration file, you can refer to the Configuration Migration Guide to help you in the transition to this new file format. ESLinthas deprecated their formatting rules since version 8.53.0. To continue using those rules and receive future updates, ESLint Stylistic was included. Because of this, all rules which were linked to formatting have changed names. For example, thesemirule is now called@stylistic/semi. If you used those rules in your custom application, please adapt your configuration file accordingly. You can refer to this migration guide to guide you in this task.
Even if you used the stock configuration files, as some linting rules were added or changed, you should expect to see error and warnings the first time you will build your updated Wegue app.
The majority of those can be fixed automatically by running the npm run lint:fix command.
If you want to momentarily bypass some advanced errors to test your upgraded app or want to adapt linting rules to better suit your preferences, you can modify the eslint.config.js file as needed.
mapGeodataDragDop property of the main Wegue application configuration was renamed mapGeodataDragDrop. Please update your configuration files accordingly.
This lists some essentials, which had to be adapted in the Wegue code regarding to the upgrade to Vue-CLI in version 5.0.7:
- The command used to run the dev build is now
npm run serve. - Some new config files are present in the root directory. Take particular attention to
vue.config.jsused to configure the build process andjsconfig.jsonto configureIDEsintegration. - The main
HTMLtemplate files which were present in the root directory are now in apublicsubfolder. Please adapt them to the needs of your Wegue application. - The build configuration which was previously made inside the
buildandconfigdirectories should be placed in thevue.config.jsfile. Please adapt it to the needs of yourWegueapplication.
The originalbuildandconfigdirectories can be removed once this is done. - Environment variables defined inside the
.env.jsfiles inside theconfigdirectory should be placed in.envfiles in the root directory.
dev.env.jsshould now be called.env.development,prod.env.jsshould now be called.env.productionandtest.env.jsshould now be called.env.test.
Please note than onlyNODE_ENV,BASE_URLand variables that start withVUE_APP_will be statically embedded into the client bundle. Please rename your variables in yourWegueapplication in case you use them after the build process.
Please refer to the official Vue-CLI Guide and vue.config.js reference when you upgrade your Wegue app.
If you're using environment variables inside your Wegue app, please read Vue-CLI's Modes and Environment Variables Guide carefully before updating your app.
Vue-CLI uses Webpack 5 and webpack-chain 6.5.1 under the hood. Please refer to Vue-CLI's Working with Webpack guide, Webpack configuration guide and webpack-chain documentation if advanced configuration is needed inside your Wegue app.
This lists some essentials, which had to be adapted in the Wegue code regarding to the upgrade to OpenLayers in version 7/8/9:
- OL
Overlayno longer acceptsautoPanAnimationas an option. Now the animation delay is passed as an object directly to the autoPan option. map.forEachLayerAtPixel()is removed. Replaced with e.g.map.getLayers().forEach().
Please have a look at the official OpenLayers upgrade notes, when you upgrade your Wegue app. Especially look for any breaking change between OpenLayers v6.4.3 and the current OpenLayers version used in Wegue v2, see package.json.
This lists some essentials, which had to be adapted in the Wegue code regarding to the upgrade to Vuetify in version 2.6.15:
- The component
<v-content>was renamed to<v-main>. Please adapt this in theWguAppTemplate.vuefile of yourWegueapplication.
The MDI icon libraries used were upgraded to the following versions:
@mdi/font=> 7.2.xmaterial-icons=> 1.13.x
Please refer to the official changelog for versions later than 5.9.55 and check if you are using removed or renamed icons. Those have to be adapted and/or replaced in your Wegue application.
ESLint and its associated plugins were upgraded to the following versions:
eslint=> 7.32.xeslint-plugin-standard=> 4.1.xeslint-plugin-vue=> 7.20.xeslint-config-standard=> 16.0.x@vue/eslint-config-standard=> 6.1.x
As lots of new linting rules were added, you should expect to see error and warnings the first time you will build your updated Wegue app.
The majority of those can be fixed automatically by running the npm run lint:fix command.
If you want to momentarily bypass some advanced errors to test your upgraded app or want to adapt linting rules to better suit your preferences, you can modify the .eslintrc.js file as needed.