Failed to resolve module specifier "vite-plugin-node-polyfills/shims/global". Relative references must start with either "/", "./", or "../". #78
Labels
missing reproduction
This issue does not provide a reproducible example of the problem.
Hello I've created an npm package using your package and I am able to build successfully. However when it runs on browser I see the error given. I suspect there is an issue in my vite.config.ts file but not sure what it is. Here's my file
`import { defineConfig } from "vite";
import wasm from "vite-plugin-wasm";
import { nodePolyfills } from "vite-plugin-node-polyfills";
import path from "path";
export default defineConfig({
resolve: {
alias: {
process: "process/browser",
path: "path-browserify",
stream: "stream-browserify",
os: "os-browserify",
},
},
plugins: [
wasm(),
nodePolyfills({
// To exclude specific polyfills, add them to this list.
exclude: [
"fs", // Excludes the polyfill for
fs
andnode:fs
.//"stream",
],
// Whether to polyfill specific globals.
globals: {
Buffer: true,
global: true,
process: true,
},
// Whether to polyfill
node:
protocol imports.protocolImports: true,
}),
],
build: {
manifest: true,
minify: true,
reportCompressedSize: true,
lib: {
entry: path.resolve(__dirname, "src/main.ts"),
fileName: "main",
formats: ["es", "cjs"],
},
target: "esnext",
rollupOptions: {
external: [
"vite-plugin-node-polyfills/shims/buffer",
"vite-plugin-node-polyfills/shims/global",
"vite-plugin-node-polyfills/shims/process",
],
},
},
});
`
The text was updated successfully, but these errors were encountered: