You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We are building a browser based project. When including the IIFE in an HTML page, the "vim" namespace (see below) is only available when minify: false, otherwise we can't access the vim namespace.
import { defineConfig } from 'vite'
export default defineConfig({
build: {
lib: {
formats: ['iife', 'es'],
entry: './src/viewer.ts',
name: 'vim'
},
// Minify set to true will break the IIFE output
minify: false,
rollupOptions: {
external: [
'three'
],
output: {
globals: {
three: 'THREE'
}
}
}
}
})
Reproduction
I am not familiar enough with vite to create a proper reproduction, but I hope the problem is clear from the description. This happens in Chrome.
Our test HTML page (pushed into the dist folder) looks like the code below, and the problem is that "vim" is declared as undefined when Vite is built with minify:true in the config, but with minify:false, all seems to work well.
Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
Make sure this is a Vite issue and not a framework-specific issue. For example, if it's a Vue SFC related bug, it should likely be reported to https://github.com/vuejs/vue-next instead.
Describe the bug
We are building a browser based project. When including the IIFE in an HTML page, the "vim" namespace (see below) is only available when
minify: false
, otherwise we can't access the vim namespace.Reproduction
I am not familiar enough with vite to create a proper reproduction, but I hope the problem is clear from the description. This happens in Chrome.
Our test HTML page (pushed into the dist folder) looks like the code below, and the problem is that "vim" is declared as undefined when Vite is built with minify:true in the config, but with minify:false, all seems to work well.
System Info
Used Package Manager
npm
Logs
No response
Validations
The text was updated successfully, but these errors were encountered: