primary-violetP
Refine2y ago
14 replies
primary-violet

casbin with refine

im trying to make an accessControlProvider with casbin following to refine's tutorial, but when i npm start, i get following error:
Identifier 'Buffer' has already been declared (at casbin.js?v=248064cd:6:3)
i have configured polyfills for vite as following:

import react from "@vitejs/plugin-react";
import { defineConfig } from "vite";

import { NodeGlobalsPolyfillPlugin } from "@esbuild-plugins/node-globals-polyfill";
import { NodeModulesPolyfillPlugin } from "@esbuild-plugins/node-modules-polyfill";
import rollupNodePolyFill from "rollup-plugin-polyfill-node";

export default defineConfig({
plugins: [react()],
server: {
open: true,
host: true,
},
optimizeDeps: {
esbuildOptions: {
// Node.js global to browser globalThis
define: {
global: "globalThis",
},
plugins: [
NodeGlobalsPolyfillPlugin({
buffer: true,
process: true,
}),
NodeModulesPolyfillPlugin(),
],
},
},
build: {
rollupOptions: {
plugins: [rollupNodePolyFill()],
},
},
});

but it didn't work
Was this page helpful?