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

fix(esbuild): add missing resolveDir to support webfont bundling #789

Merged
merged 1 commit into from Jul 11, 2021

Conversation

dfrkp
Copy link
Contributor

@dfrkp dfrkp commented Jun 25, 2021

Motivation

When attempting to bundle a font before, esbuild would complain:

> linaria:App_hash.linaria.css:1:46: error: Could not resolve "./font.ttf" (the plugin "linaria" didn't set a resolve directory)
    1 ? @font-face{font-family:"font";src:url("./font.ttf");}...

Summary

With this fix the resolveDir is set to the basedir of the file loading the font (or other external asset) and thus relative paths should work just fine.

Test plan

Note: When testing this, configure the esbuild build to include the appropriate loader, e.g.:

    loader: { ".ttf": "dataurl" },

When attempting to bundle a font before, esbuild would complain:
> linaria:App_hash.linaria.css:1:46: error: Could not resolve "./font.ttf" (the plugin "linaria" didn't set a resolve directory)
    1 ? @font-face{font-family:"font";src:url("./font.ttf");}...

With this fix the resolveDir is set to the basedir of the file loading
the font (or other external asset) and thus relative paths should work
just fine.

Note: When testing this configure the esbuild build to include the
appropriate loader, e.g.:
    loader: { ".ttf": "dataurl" },
@callstack-bot
Copy link

Hey @dfrkp, thank you for your pull request 🤗.
The coverage report for this branch can be viewed here.

@Anber Anber merged commit 45e5de0 into callstack:master Jul 11, 2021
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.

None yet

3 participants