metaplex-foundation / js-examples

Examples and Starter Kits using the new JS SDK
MIT License
79 stars 92 forks source link

Production issue #33

Closed florian-deroo closed 1 year ago

florian-deroo commented 1 year ago

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,
  },

});
florian-deroo commented 1 year ago

with this repo you can reproduce the problem:

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