metaplex-foundation/js-examples

Production issue

florian-deroo opened this issue · 1 comments

Hi! With the following code in development mode, everything works but when I go to production nothing works anymore:

const connection = new Connection(clusterApiUrl("devnet"));
  const metaplex = new Metaplex(connection);

  const nft = await metaplex.nfts().findAllByOwner({
    owner: publicKey,
  })

  console.log(nft)

I'm using ViteJS with this config

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

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [react()], // Or svelte(), etc.
  resolve: {
    alias: {
      stream: "rollup-plugin-node-polyfills/polyfills/stream",
    },
  },
  define: {
    "process.env": process.env,
  },
  
});

with this repo you can reproduce the problem:

https://github.com/florian-deroo/test-project