-
-
Notifications
You must be signed in to change notification settings - Fork 35.8k
Vite: Duplicate imports when mixing three/tsl and three/webgpu #31102
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
Comments
Can you pinpoint when these warnings started to appear? A release version would already be helpful. Even better the PR that introduces the issue. |
@Mugen87 seems what im doing is only available since 171.0 To give more context i saw this warning recently and especially this monrning while plugged tsl/webgpu version to : unplugin-auto-import using : // tslImports.ts
import * as tsl from 'three/tsl'
const tslNames = Object.keys(tsl) as (keyof typeof tsl)[]
const tslImports = [ ...tslNames ]
export default tslImports
export { tslImports } // webgpuImports.ts
import * as webgpu from 'three/webgpu'
const webgpuNames = Object.keys(webgpu) as (keyof typeof webgpu)[]
const webgpuImports = [ ...webgpuNames ]
export default webgpuImports
export { webgpuImports } // in vite config
AutoImport({
include: [/\.[tj]sx?$/, /\.vue$/, /\.vue\?vue/, /\.md$/],
imports: [
'vue',
'vue-router',
{
'three/tsl': tslImports,
'three/webgpu': webgpuImports
}
],
vueTemplate: true,
eslintrc: { enabled: true }
}), |
The class concern by the double definition in both |
Do you know what the resulting code from https://github.com/unplugin/unplugin-auto-import looks like here? The warning suggests that you have multiple imports in the same file referring to the same export, which would otherwise be invalid. |
I've been mixing imports from // vite.config.ts
import { defineConfig } from 'vite'
import preact from '@preact/preset-vite'
export default defineConfig({plugins: [preact()]}) |
Hi! I am not sure if this helps, I have replicated the issue on my end and this is how I fixed the import issues that you have. This is the modified vite.config.js: // vite.config.js
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import AutoImport from 'unplugin-auto-import/vite'
import tslImports from './src/config/tslImports'
import webgpuImports from './src/config/webgpuImports'
// List of conflicting symbols
const CONFLICTING_SYMBOLS = [
"NodeAccess",
"NodeShaderStage",
"NodeType",
"NodeUpdateType",
"defaultBuildStages",
"defaultShaderStages",
"shaderStages",
"vectorComponents"
]
export default defineConfig({
plugins: [
vue(),
AutoImport({
include: [/\.[tj]sx?$/, /\.vue$/, /\.vue\?vue/],
imports: [
'vue',
{
// Filter out conflicting symbols from TSL
'three/tsl': tslImports.filter(name => !CONFLICTING_SYMBOLS.includes(name)),
// Use all webgpu imports
'three/webgpu': webgpuImports
}
],
vueTemplate: true,
eslintrc: {
enabled: true,
filepath: './.eslintrc-auto-import.json'
},
dts: './auto-imports.d.ts',
})
]
}) |
Description
I recently got warning in vite when i'm importing from
three/tsl
andthree/webgpu
Reproduction steps
Code
X
Live example
X
Screenshots
X
Version
r176
Device
No response
Browser
No response
OS
No response
The text was updated successfully, but these errors were encountered: