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

avoid relying on __dirname global constant #1237

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Javier-Rotelli
Copy link

Fixes #1235

What's Changing and Why

Removed usage of global variable __dirname to avoid errors when bundling with rollup

What else might be affected

Tasks

  • Add tests
  • Update Documentation
  • Update jimp.d.ts
  • Add SemVer Label

import bMFont from "load-bmfont";
import { isNodePattern, throwError } from "@jimp/utils";
import { measureText, measureTextHeight, splitLines } from "./measure-text";

const __filename = url.fileURLToPath(import.meta.url);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does all compiled output have the correct code here?

ex:

  • cjs
  • esm
  • browser

Once verified will merge

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let me check.
I can say for sure that esm is working.
the other two I have to check. any direction on how to do it correctly would be appreciated
Thanks!

@xavier-villelegier
Copy link

Hey hey @Javier-Rotelli @hipstersmoothie, any plan to get this merged ? 👀 It's really blocking when using Vite…

@hipstersmoothie
Copy link
Collaborator

We would have to make sure it works for all envs, not just modules

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.

__dirname err - module build of jimp
3 participants