diff --git a/src/build.ts b/src/build.ts index 98b5a74..3726328 100644 --- a/src/build.ts +++ b/src/build.ts @@ -1,7 +1,6 @@ import { build as viteBuild, mergeConfig } from 'vite' import { type InlineConfig, type MainViteConfig, type PreloadViteConfig, resolveConfig } from './config' import { BytecodeCompiler } from './bytecodeCompiler' -import { BYTECODE_BUILD_PLUGIN_NAME } from './constants' import { asyncFlatten } from './utils' async function usesBytecode(config?: MainViteConfig | PreloadViteConfig): Promise { @@ -20,7 +19,7 @@ export async function build(inlineConfig: InlineConfig = {}): Promise { const bytecodeCompiler = new BytecodeCompiler() const config = await resolveConfig( mergeConfig(inlineConfig, { - plugins: [{ name: BYTECODE_BUILD_PLUGIN_NAME, api: { compiler: bytecodeCompiler } }] + plugins: [{ name: 'vite:electron-bytecode-build', api: { compiler: bytecodeCompiler } }] }), 'build', 'production' diff --git a/src/constants.ts b/src/constants.ts deleted file mode 100644 index 05ad834..0000000 --- a/src/constants.ts +++ /dev/null @@ -1 +0,0 @@ -export const BYTECODE_BUILD_PLUGIN_NAME = 'vite:electron-bytecode-build' diff --git a/src/plugins/bytecode.ts b/src/plugins/bytecode.ts index 8ab0f28..d39cf6a 100644 --- a/src/plugins/bytecode.ts +++ b/src/plugins/bytecode.ts @@ -6,12 +6,11 @@ import * as babel from '@babel/core' import MagicString from 'magic-string' import { toRelativePath } from '../utils' import type { BytecodeCompiler, BytecodeTarget } from '../bytecodeCompiler' -import { BYTECODE_BUILD_PLUGIN_NAME } from '../constants' // Inspired by https://github.com/bytenode/bytenode function getBytecodeCompiler(plugins: readonly Plugin[]): BytecodeCompiler | undefined { - const plugin = plugins.find(plugin => plugin.name === BYTECODE_BUILD_PLUGIN_NAME) + const plugin = plugins.find(plugin => plugin.name === 'vite:electron-bytecode-build') return (plugin?.api as { compiler?: BytecodeCompiler } | undefined)?.compiler }