Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nuxt dev preload script not loaded #73

Closed
Venipa opened this issue Apr 15, 2024 · 2 comments
Closed

nuxt dev preload script not loaded #73

Venipa opened this issue Apr 15, 2024 · 2 comments

Comments

@Venipa
Copy link

Venipa commented Apr 15, 2024

im unable to load the preload script into the window,

BrowserWindow config:

// dont mind the createWindow function
const win = await createWindow("/", {
    minWidth: 1280,
    width: 1280,
    minHeight: 720,
    height: 720,
    webPreferences: {
      preload: "dist-electron/api.js"
    }
  });

nuxt.config.ts

export default defineNuxtConfig({
  devtools: { enabled: false },
  modules: ['nuxt-electron', '@nuxtjs/tailwindcss', "shadcn-nuxt", "nuxt-icon", "@nuxt/image", '@nuxtjs/i18n'],
  srcDir: "src/",
  css: ["~/assets/css/tailwind.css", "~/assets/css/app.scss"],
  ssr: false,
  experimental: { appManifest: false },
  electron: {
    build: [
      {
        // Main-Process entry file of the Electron App.
        entry: 'src/electron/main.ts',
      },
      {
        entry: 'src/electron/preload/api.ts',
        onstart(args) {
          args.reload();
        },
      }
    ],
  },
  shadcn: {
    /**
     * Prefix for all the imported component
     */
    prefix: '',
    /**
     * Directory that the component lives in.
     * @default "./components/ui"
     */
    componentDir: 'src/components/ui'
  },
  image: {
    dir: "images/"
  },
  i18n: {
    locales: [
      {
        code: "en",
        file: "en.json"
      }
    ],
    defaultLocale: "en",
    langDir: "translations/"
  }
})

package.json:


  "name": "nuxt-app",
  "private": true,
  "type": "module",
  "main": "dist-electron/main.js",
  "version": "0.1.0",
  "scripts": {
    "build": "nuxt build",
    "dev": "nuxt dev",
    "generate": "nuxt generate",
    "preview": "nuxt preview",
    "postinstall": "nuxt prepare"
  },
  "dependencies": {
    "@radix-icons/vue": "^1.0.0",
    "@vee-validate/zod": "^4.12.6",
    "@vueuse/core": "^10.9.0",
    "class-variance-authority": "^0.7.0",
    "clsx": "^2.1.0",
    "electron-store": "^8.2.0",
    "embla-carousel": "^8.0.2",
    "embla-carousel-vue": "^8.0.2",
    "express": "^4.19.2",
    "got": "^14.2.1",
    "gotql": "^2.1.0-alpha1",
    "keytar": "^7.9.0",
    "lodash-es": "^4.17.21",
    "nuxt": "3.10.2",
    "radix-vue": "^1.7.0",
    "tailwind-merge": "^2.2.2",
    "tailwindcss-animate": "^1.0.7",
    "v-calendar": "^3.1.2",
    "vaul-vue": "^0.1.0",
    "vee-validate": "^4.12.6",
    "vue": "^3.4.21",
    "vue-router": "^4.3.0",
    "vue-sonner": "^1.1.2",
    "winston": "^3.13.0",
    "zod": "^3.22.4"
  },
  "devDependencies": {
    "@nuxt/image": "^1.5.0",
    "@nuxtjs/i18n": "^8.3.0",
    "@nuxtjs/tailwindcss": "^6.11.4",
    "@types/express": "^4.17.21",
    "@types/got": "^9.6.12",
    "@types/keytar": "^4.4.2",
    "@types/lodash-es": "^4.17.12",
    "@types/node": "^20.12.7",
    "electron": "^29.3.0",
    "electron-builder": "^24.13.3",
    "nuxt-electron": "^0.7.0",
    "nuxt-icon": "^0.6.10",
    "sass": "^1.75.0",
    "shadcn-nuxt": "^0.10.2",
    "vite-plugin-electron": "^0.28.4",
    "vite-plugin-electron-renderer": "^0.14.5",
    "webpack-env": "^0.8.0"
  },
  "resolutions": {
    "nuxi": "3.10.1"
  }
@Venipa
Copy link
Author

Venipa commented Apr 16, 2024

Absolute paths work it seems

@caoxiemeihao
Copy link
Owner

caoxiemeihao commented Apr 18, 2024

image

https://www.electronjs.org/docs/latest/api/structures/browser-window-options

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

No branches or pull requests

2 participants