Vue Nuxtjs generates nuxt files with wrong import syntax, how do I fix it?

225 Views Asked by At

Im developing a simple project with Vue and Nuxtjs. I'm starting it with yarn dev but when the nuxt files get generated I get a friendly error which says the following:

Error message

So I checked the .nuxt directory and the imports for my files had the wrong syntax:

const _16d0ac86 = () => interopDefault(import('..\\pages\\index.vue' /* webpackChunkName: "pages/index" */))

So the import has a backward slash "\" instead of a regular one "/". This is obviously wrong but I don't know what triggered it, it worked normally yesterday. I removed the changes I did today and this happened still.

I already deleted my node_modules directory and reinstalled all my dependencies, I also deleted my nuxt files and rebuild it. Hope you can help! Here is my nuxt.config.js file

  // Disable server-side rendering: https://go.nuxtjs.dev/ssr-mode
  ssr: false,

  // Global page headers: https://go.nuxtjs.dev/config-head
  head: {
    title: 'giftshop-nuxtjs',
    htmlAttrs: {
      lang: 'en',
    },
    meta: [
      { charset: 'utf-8' },
      { name: 'viewport', content: 'width=device-width, initial-scale=1' },
      { hid: 'description', name: 'description', content: '' },
      { name: 'format-detection', content: 'telephone=no' },
    ],
    link: [{ rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }],
  },

  // Global CSS: https://go.nuxtjs.dev/config-css
  css: [],

  // Plugins to run before rendering page: https://go.nuxtjs.dev/config-plugins
  plugins: [],

  // Auto import components: https://go.nuxtjs.dev/config-components
  components: true,
  generate: {
    // choose to suit your project
    interval: 2000,
  },

  // Modules for dev and build (recommended): https://go.nuxtjs.dev/config-modules
  buildModules: [
    // https://go.nuxtjs.dev/typescript
    '@nuxt/typescript-build',
    // https://go.nuxtjs.dev/tailwindcss
    '@nuxtjs/tailwindcss',

    '@nuxtjs/composition-api/module',
  ],

  // Modules: https://go.nuxtjs.dev/config-modules
  modules: [
    // https://go.nuxtjs.dev/axios
    '@nuxtjs/axios',
    'vue-toastification/nuxt',
  ],

  // Axios module configuration: https://go.nuxtjs.dev/config-axios
  axios: {
    baseURL: 'http://localhost:3002',
  },

  // Build Configuration: https://go.nuxtjs.dev/config-build
  build: {},
}```
0

There are 0 best solutions below