Search code examples
reactjsyarnpkgvitesolanasolana-web3js

Uncaught ReferenceError: __VITE_IS_MODERN__ is not defined


I am working with @solana/web3.js and @solana/spl-token but I am getting error

Uncaught ReferenceError: __VITE_IS_MODERN__ is not defined
  at modulepreload-polyfill:43:3

I am not sure which library is causing this.

My import packages list is here:

import { useState, useEffect, useRef } from "react"; 
 import Select from "react-select";
import "vite/modulepreload-polyfill"; 
import {Transaction } from "@solana/web3.js";
import { Connection, PublicKey, Keypair, Transaction} from "@solana/web3.js";
import {Token, TOKEN_PROGRAM_ID,ASSOCIATED_TOKEN_PROGRAM_ID, } from "@solana/spl-token"; 
import bs58 from "bs58";

package.json:

package.json


Solution

  • Remove the line

    import "vite/modulepreload-polyfill";