I can't import the web3 file there is an error ,SyntaxError: Cannot use import statement outside a module
I used npm, to install the web3 library
this error is in the phaser
Try using
const web3 = require("web3.js");
If you want to use the import statement you need to add a line in your package.json called "type": "module", learn more here.
This is more of a JS error in general. You can use const Web3 = require('web3');
to import.
//INDEX.JS file
const Web3 = require("web3"); //The keyword web3 is case sensative
const web3 = new Web3("RPC LINK"); //Connect to an RPC and start using web3
... //more code
Or you can edit package.json. You will need put "type": "module",
at the root of your JSON file.
//PACKAGE.JSON file
{
"name": "index",
"version": "1.0.0",
"description": "",
"main": "index.js",
"type": "module",
... //more
}