-
Hello all, I'm a bit stuck so I wanted to see if anyone can help me a bit. I have just completed the upgrade of vite from v5 to v6. import path from 'path';
import { defineConfig, loadEnv } from 'vite';
import react from '@vitejs/plugin-react';
import packageJson from './package.json';
const DEFAULT_PORT = 9001;
// https://vitejs.dev/config/
export default defineConfig(({ mode }) => {
const env = loadEnv(mode, process.cwd());
const dontOpenBrowser = env.VITE_BROWSER === 'none';
return {
build: {
lib: {
entry: packageJson.main,
name: path.basename(__dirname),
fileName: 'index',
formats: ['esm'],
},
minify: true,
rollupOptions: {
input: packageJson.main,
output: {},
},
sourcemap: mode !== 'production',
},
envDir: '../../',
plugins: [react()],
server: {
port: DEFAULT_PORT
},
};
}); This config was working fine in the previous version, so it might be I missed something in the upgrade. Consider also that one of the changes during the upgrade was to move Vite as a dependency in the monorepo root, and remove it from each package. I have not found anyone suggesting this shouldn't be done, but just want to be explicit, just in case. Lastly, the error:
as you can probably imagine, In
( This should be it, isn't it? Now the application builds fine... BUT When loading my application I get this error which breaks everything: Suggestions? Am I missing anything? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Same issue here. It seems to only occur on Windows. #20293 |
Beta Was this translation helpful? Give feedback.
-
I managed to get around this specific issue by adding optimizeDeps: {
include: ['react-redux', '@redux/toolkit'],
}, to the |
Beta Was this translation helpful? Give feedback.
I managed to get around this specific issue by adding
to the
vite.config.js
file. Now I'm stuck on another problem.