Skip to content

Can't get assets to load in asar #274

@kieranbarlow

Description

@kieranbarlow

Hello,

I've tried numerous ways but I can't get the assets folder which contains the various vite assets to be compiled within the .asar.

Here is my vite.config. Can someone tell me what I'm doing wrong?

import vue from '@vitejs/plugin-vue'
import path from 'path'
import { defineConfig } from 'vite'
import electron from 'vite-plugin-electron/simple'

export default defineConfig(({ command }) => {
  const isBuild = command === 'build'

  return {
    plugins: [
      vue(),
      electron({
        main: {
          entry: 'electron/main.js',
          vite: {
            build: {
              sourcemap: !isBuild ? 'inline' : false, 
              minify: isBuild,
              outDir: 'dist-electron/main',
              rollupOptions: {

                external: [], 
              },
            },
          },
        },
        renderer: {
          vite: {
            build: {
              sourcemap: !isBuild ? 'inline' : false,
              minify: isBuild,
              outDir: 'dist-electron/renderer',
            },
          },
        },
      }),
    ],
    resolve: {
      alias: {
        '@': path.resolve(__dirname, './src'),
      },
    },
    base: './', 
    server: {
      open: true,
    },
    build: {
      outDir: 'dist',
      rollupOptions: {
        input: path.resolve(__dirname, 'index.html'),
      },
    },
    clearScreen: false,
  }
})

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions