Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: global._dirname is not a function #17

Open
plesdisgila opened this issue Sep 18, 2023 · 3 comments
Open

TypeError: global._dirname is not a function #17

plesdisgila opened this issue Sep 18, 2023 · 3 comments

Comments

@plesdisgila
Copy link

ada yg tau untuk mengatasi ini?
image

@DavidModzz
Copy link

Try removing the "global."
_dirname(import.meta.url)

@byshivam
Copy link

removing global from global._dirname(import.meta.url) not work for

I try to make function :

global._dirname = function _dirname(url) {
  const urlObj = new URL(url);
  return decodeURIComponent(urlObj.pathname.substring(1));
};

const _dirname = global._dirname(import.meta.url)

But still facing some issue Like Connection error :(

@GenProject05
Copy link

GenProject05 commented Oct 14, 2023

image

I tried this code it worked, but after scan the QR code it not

// (previous code)

global.filename = function filename(pathURL, rmPrefix) {
    if (rmPrefix) {
        if (/file:\/\/\//.test(pathURL)) {
            return fileURLToPath(pathURL);
        } else {
            return pathURL;
        }
    } else {
        return pathToFileURL(pathURL).toString();
    }
};

global._dirname = function dirname(pathURL) {
    return path.dirname(global.filename(pathURL, true));
};

// (the rest of your code)

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

No branches or pull requests

4 participants