Add support for nuxt 3
See original GitHub issueAdding the google analytics module to nuxt 3 generates the following errors:
- ERROR Error compiling template
- ERROR Cannot start nuxt: serialize is not defined
Here my nuxt config
import { defineNuxtConfig } from 'nuxt3'
// https://v3.nuxtjs.org/docs/directory-structure/nuxt.config
export default defineNuxtConfig({
css: ["~/assets/css/styles.css"],
build: {
postcss: {
postcssOptions: require("./postcss.config.js"),
},
},
modules: [
['@nuxtjs/google-analytics', { ua: 'X1234567' }],
]
})
Issue Analytics
- State:
- Created 2 years ago
- Reactions:5
- Comments:12
Top Results From Across the Web
feat!: Add support for Nuxt 3 by dankerow · Pull Request #12
This PR enables this module to work for Nuxt 3. Notable changes Uses @nuxt/module-builder to build module. Refactor structure (lib -> src, ...
Read more >Nuxt 3 first steps. - ITNEXT
OK, first things first. What's nuxi ? It's the new Nuxt CLI (Command Line Interface) that will help you install and manage all...
Read more >Modules - Migrate to Nuxt 3
Plugins or components using the Composition API need exclusive Vue 2 or Vue 3 support. By using vue-demi they should be compatible with...
Read more >Configuration - Nuxt
This default configuration can be overwritten with the nuxt.config.js file. ... In nuxt.config.js , add the CSS resources: nuxt.config.js
Read more >Nuxt 3 integration - Vue I18n - Intlify
In the following sections, we will work on Nuxt 3 applications that support English, French, and Japanese. Add language switching #. We will...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@afiorenza Yes, I changed the package to
yarn add vue-gtag-next
, then I createdvue-gtag.client.js
in the plugins folder at the project root.vue-gtag.client.js
For nuxt 3 RC 11, the below code works fine.
Create
ga.js
file inplugins
folder. No need to import or change anything innuxt.config.js
. You can name anything actually. I have named itga.js
.