Skip to content

Unable to run in development mode but production build works #15129

@marcodarko

Description

@marcodarko

Environment


  • Operating System: Darwin
  • Node Version: v17.9.0
  • Nuxt Version: 3.0.0-rc.10
  • Nitro Version: 0.5.5-27756662.9e9cfe0
  • Package Manager: npm@8.5.5
  • Builder: vite
  • User Config: -
  • Runtime Modules: -
  • Build Modules: -

Reproduction

plugin

import { defineNuxtPlugin } from '#app'
  
import store from  '@/store'
 
export default defineNuxtPlugin((nuxtApp) => {
  nuxtApp.vueApp.use(store)
})

Store

import { createStore } from "vuex";
import { auth } from "./modules/auth";

export default createStore({
  modules: {
    auth,
  },
......
});

package.json

{
  "private": true,
  "scripts": {
    "build": "nuxt build",
    "dev": "nuxt dev",
    "generate": "nuxt generate",
    "preview": "nuxt preview",
    "postinstall": "nuxt prepare"
  },
  "devDependencies": {
    "nuxt": "3.0.0-rc.10"
  },
  "dependencies": {
    "@codemirror/autocomplete": "github:codemirror/autocomplete",
    "@codemirror/lang-json": "github:codemirror/lang-json",
    "@codemirror/view": "github:codemirror/view",
    "@fortawesome/fontawesome-svg-core": "^6.2.0",
    "@fortawesome/free-brands-svg-icons": "^6.1.2",
    "@fortawesome/free-regular-svg-icons": "^6.1.2",
    "@fortawesome/free-solid-svg-icons": "^6.1.2",
    "@fortawesome/vue-fontawesome": "^3.0.1",
    "ajv": "^8.11.0",
    "ajv-formats": "^2.1.1",
    "axios": "^0.21.4",
    "chart.js": "^3.9.1",
    "clipboard": "^2.0.11",
    "codemirror": "^6.0.1",
    "cytoscape": "^3.22.1",
    "cytoscape-dagre": "^2.4.0",
    "lodash": "^4.17.21",
    "mark.js": "^8.11.1",
    "moment": "^2.29.4",
    "papaparse": "^5.3.2",
    "renderjson": "^1.4.0",
    "showdown": "^2.1.0",
    "simple-notify": "^0.5.5",
    "sweetalert2": "^11.4.33",
    "tabulator-tables": "^5.3.2",
    "tippy.js": "^6.3.7",
    "vue-gtag-next": "^1.14.0",
    "vue-router": "^4.1.2",
    "vue-sweetalert2": "^5.0.5",
    "vuex": "^4.0.2"
  }
}

Run
npm run dev

Describe the bug

It was all working fine then after trying to run the app again with no changes this error popped up and all my work has come to a complete stop.
I can't describe the bug any further as I can't spot the issue, very similar to this issue: https://stackoverflow.com/questions/73284702/nuxt-3-pinia-h3-unhandled-h3error-vite-ssr-import-0-definestore-is

I did notice that Nuxt's MHR stopped working before this happened, I had to refresh to see any changes. Only thing I did was restart the app then I was hit with this error.

Screen Shot 2022-10-10 at 2 44 05 PM

Additional context

No response

Logs

[nuxt] [request error] [unhandled] [500] __vite_ssr_import_0__.createStore is not a function
  at ./store/index.js:26:54
  at runMicrotasks (<anonymous>)
  at processTicksAndRejections (node:internal/process/task_queues:96:5)
  at async ViteNodeRunner.directRequest (./node_modules/vite-node/dist/client.mjs:251:5)
  at async ViteNodeRunner.cachedRequest (./node_modules/vite-node/dist/client.mjs:128:12)
  at async request (./node_modules/vite-node/dist/client.mjs:151:16)
  at async ./plugins/store.js:4:31
  at async ViteNodeRunner.directRequest (./node_modules/vite-node/dist/client.mjs:251:5)
  at async ViteNodeRunner.cachedRequest (./node_modules/vite-node/dist/client.mjs:128:12)
  at async request (./node_modules/vite-node/dist/client.mjs:151:16)
[nuxt] [request error] [unhandled] [500] __vite_ssr_import_0__.createStore is not a function
  at ./store/index.js:26:54
  at runMicrotasks (<anonymous>)
  at processTicksAndRejections (node:internal/process/task_queues:96:5)
  at async ViteNodeRunner.directRequest (./node_modules/vite-node/dist/client.mjs:251:5)
  at async ViteNodeRunner.cachedRequest (./node_modules/vite-node/dist/client.mjs:128:12)
  at async request (./node_modules/vite-node/dist/client.mjs:151:16)
  at async ./plugins/store.js:4:31
  at async ViteNodeRunner.directRequest (./node_modules/vite-node/dist/client.mjs:251:5)
  at async ViteNodeRunner.cachedRequest (./node_modules/vite-node/dist/client.mjs:128:12)
  at async request (./node_modules/vite-node/dist/client.mjs:151:16)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions