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

__filename is not defined (ESM) #703

Open
iDVB opened this issue Sep 23, 2024 · 1 comment
Open

__filename is not defined (ESM) #703

iDVB opened this issue Sep 23, 2024 · 1 comment

Comments

@iDVB
Copy link

iDVB commented Sep 23, 2024

Package doesn't support ESM?

ReferenceError: __filename is not defined

node_modules/.pnpm/@[email protected]/node_modules/@contentful/node-apps-toolkit/lib/keys/get-management-token.js102:179
        defaultCache = new NodeCache();
    }
    const httpClientOpts = typeof opts.host !== 'undefined' ? { prefixUrl: opts.host } : {};
    return (0, exports.createGetManagementToken)((0, utils_1.createLogger)({ filename: __filename }), (0, utils_1.createHttpClient)(httpClientOpts), defaultCache)(privateKey, opts);
};
exports.getManagementToken = getManagementToken;

Should likely has an ESM supported build?

// Import the URL module to resolve file paths
import { fileURLToPath } from 'url'

// ESM replacement for __filename
const __filename = fileURLToPath(import.meta.url)
@whitelisab
Copy link
Contributor

Hi @iDVB! Thanks for this feedback, I've created a ticket in our team's backlog and we will keep you updated on it's progress.

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

2 participants