Skip to content

Conversation

ozdemirozcelik
Copy link
Contributor

@ozdemirozcelik ozdemirozcelik commented Aug 29, 2025

This PR is for migrating from Vue CLI to Vite and it does the following:

  • Moves index.html from the public folder to the root folder
  • Updates index.html and replaces code blocks that requires webpack with plain html
  • Updates package.json with required Vite packages
  • Updates main.js, removing code blocks not compatible with Vite
  • Adds a vite.config.js file, setting required server and build configurations
  • Deletes babel.config.js and vue.config.js as they are not needed any more
  • Updates README.md to to reference the use of Vite

Please refer to the ticket GDXDSD-7995 for testing instructions.

@@ -4,8 +4,8 @@
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Vite does not process <%= %>. We are not using webpack any more and using plain html should work fine.

Comment on lines -5 to -6
"serve": "vue-cli-service serve",
"build": "vue-cli-service build"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Replaced with Vite's equivalents.

"webpack-dev-server": "^5.2.1"
"@vitejs/plugin-vue": "^6.0.1",
"vite": "^7.1.3"
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Vue CLI uses Webpack + Babel under the hood. Vite, together with @vitejs/plugin-vue , replaces both Webpack and Babel with a modern, faster toolchain.

Comment on lines +5 to +7
"dev": "vite",
"build": "vite build",
"preview": "vite preview"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

  • "npm run dev" runs Vite’s dev server, equivalent to the “npm run serve” in Vue CLI. (Default is http://localhost:5173/, but we’ve set the port to 8080 in config)
  • “npm run build” creates a production build of the app (same as Vue CLI)
  • “npm run preview” runs a local static test server, letting to test the built app before deploying (no built-in equivalent in Vue CLI)

@@ -4,8 +4,8 @@
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
<title><%= htmlWebpackPlugin.options.title %></title>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Vite does not process <%= %>. We are not using webpack any more and using plain html should work fine.

</head>
<body>
<noscript>
<strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
</noscript>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Vite does not process <%= %>. We are not using webpack any more and using plain html should work fine.

app.config.productionSourceMap = false
}

// This is a global After-Hook which calls the Snowplow page tracking event.
Copy link
Contributor Author

@ozdemirozcelik ozdemirozcelik Aug 29, 2025

Choose a reason for hiding this comment

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

productionSourceMap doesn’t exist in Vite (it is a webpack option). For Vite, it should be configured in vite.config.js See: examples/vue_js_tracker/vite.config.js
Note: By disabling source maps, browsers only see minified code in production build (no .map file), making it smaller and more secure.

build: {
sourcemap: false // disables source maps for production
}
}) No newline at end of file
Copy link
Contributor Author

Choose a reason for hiding this comment

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

By disabling source maps, browsers only see minified code in production build (no .map file), making it smaller and more secure.

server: {
port: 8080
},
build: {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The app will run on http://localhost:8080/

@ozdemirozcelik ozdemirozcelik marked this pull request as ready for review August 29, 2025 23:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant