-
Describe the bugWhen linking a local package built and exported in a non-ESM format, it is no longer pre-bundled by default (guessing to avoid caching issues). However, this linked package needs to run through the transformation process from UMD to ESM. To fix, I add the linked package with One way I've worked around this, though not really feasible, is to have the UMD package also export as ESM through Webpack's experimental feature experiments.outputModule: true and import that instead. That way, I don't need to include it in optimizeDeps.include for conversion. But it doesn't feel like a proper fix. ReproductionN/A (npm link and cache issue, not code issue) Steps to reproduce
System InfoSystem:
OS: macOS 12.6.1
CPU: (10) arm64 Apple M1 Max
Memory: 33.99 GB / 64.00 GB
Shell: 3.5.0 - /usr/local/bin/fish
Binaries:
Node: 18.11.0 - ~/.local/share/nvm/v18.11.0/bin/node
Yarn: 1.22.19 - ~/.yarn/bin/yarn
npm: 8.19.2 - ~/.local/share/nvm/v18.11.0/bin/npm
Browsers:
Chrome: 107.0.5304.110
Firefox: 107.0
Safari: 16.1
npmPackages:
@vitejs/plugin-react: ^2.1.0 => 2.1.0
vite: ^3.1.0 => 3.1.8 Used Package Managernpm LogsNo response Validations
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
Hey. Please see the explaination here: #10924 (comment)
|
Beta Was this translation helpful? Give feedback.
-
Yes! There's an easy solution! Just use this plugin:
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
import commonjs from 'vite-plugin-commonjs'
// https://vitejs.dev/config/
export default defineConfig({
plugins: [react(), commonjs()],
}); It just works! 🥳 |
Beta Was this translation helpful? Give feedback.
Hey. Please see the explaination here: #10924 (comment)