Hello!
We're migrating from v4 to v5 and want to use defineConfig for global repalcement and conditional imports:
define: {
_VERSION_: JSON.stringify(process.env.npm_package_version),
_PLATFORM_: JSON.stringify('Desktop'),
_ENGINE_: JSON.stringify('electron'),
},
However, we can't seem to use global repalcements for dynamic imports:
import Tone from './tone/_ENGINE_.js'
import Push from './push/_ENGINE_.js'
We end up with the following error:
Could not resolve "./push/_ENGINE_.js" from "src/js/main.js"
Looking for suggestions, thanks for any help :D
Top comments (1)
You can try using the resolve.alias (vitejs.dev/config/shared-options.h...) option for this, but I think all the paths would need to be specified manually.
If this is an issue, you could try supplying resolve.alias.customResolver (github.com/rollup/plugins/tree/mas...) and replacing the defines there.