翠 / green

Results 246 comments of 翠 / green

This seems to be an upstream issue. https://github.com/rollup/rollup/issues/4496

It seems these workaround works. ```js // using ESM inertiajs import { defineConfig } from 'vite' import vue from '@vitejs/plugin-vue2' export default defineConfig({ plugins: [ vue(), ], resolve: { alias:...

It worked correctly when you opt-in esbuild deps optimization at build time. https://vitejs.dev/guide/migration.html#using-esbuild-deps-optimization-at-build-time Also it worked with 3.0.0-beta.2 but didn't work with 3.0.0-beta.3. https://stackblitz.com/edit/github-rfkfeg?file=package.json,main.js,vite.config.js Maybe `@rollup/plugin-commonjs` v22 is affecting this...

I suppose the problem here is your project locates in C drive but the yarn global cache locates in D drive and Vite fails to handle that. related: #4302 #4635

My bad. Anyway, the cross-drive symlink/junction is the root cause here. Maybe it will work if you move the global cache to C drive.

@HasanMothaffar Would you test if moving global cache to the same drive works? `yarn config set cache-folder ` is the command, I suppose. https://classic.yarnpkg.com/en/docs/cli/cache#toc-change-the-cache-path-for-yarn

This issue is simillar to #7053. - `react-moment`(cjs) is importing `moment` by `import` (which is transpiled to `require`) [here](https://github.com/headzoo/react-moment/blob/9568de4fa1ad2f72c2bd7cf7a031fc0997a96b85/src/index.jsx#L3). - `moment` is resolved to `moment/dist/moment.js`(esm) by `jsnext:main` field. After prebundle,...

I digged down a bit more. `moment` is resolved by `jsnext:main` field here. https://github.com/vitejs/vite/blob/fe4c1edbe009e1df340b4d879c02d2e57a6cd7f0/packages/vite/src/node/plugins/resolve.ts#L773-L780 So for a workaround, setting [`resolve.mainFields`](https://vitejs.dev/config/#resolve-mainfields) to `[]` will work. I am not sure whether it...