Skip to content

Conversation

@AyzeLYC
Copy link

@AyzeLYC AyzeLYC commented Sep 7, 2025

Under the latest NodeJS versions if you want to use require you have to use :

import { createRequire } from "node:module"; // imports the createRequire function from the NodeJS CommonJS module handler
const require = createRequire(import.meta.url); // initializes the require function that NodeJS had under CommonJS

@extremeheat
Copy link
Member

This is not correct

@extremeheat extremeheat closed this Sep 7, 2025
@extremeheat
Copy link
Member

extremeheat commented Sep 7, 2025

Update your node to latest (v24) if you have issue importing the package with ESM

@AyzeLYC
Copy link
Author

AyzeLYC commented Sep 10, 2025

This is not correct

you should try it first before saying than it doesn't work, because on my end it does work

@extremeheat
Copy link
Member

flying-squid (as with all the other prismarinejs projects) are commonjs, not ESM. You cannot use ESM with them. If you are on a newer version of node and using ESM, you can import commonjs with a standard ESM import.

@extremeheat
Copy link
Member

As for switching to ESM, refer to PrismarineJS/prismarine-contribute#5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants