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

MsdfGenerator issue on AWS CodeBuild CI/CD platform #125

Open
tuncayyildirtanuk opened this issue Jul 25, 2024 · 8 comments
Open

MsdfGenerator issue on AWS CodeBuild CI/CD platform #125

tuncayyildirtanuk opened this issue Jul 25, 2024 · 8 comments

Comments

@tuncayyildirtanuk
Copy link

When configuring Vite via blitsVitePlugins, I encountered the following issue exclusively on the AWS CodeBuild platform.

Screenshot 2024-07-25 at 13 42 14

As a workaround, I used only the preCompiler and temporarily removed the msdfGenerator.

import { defineConfig } from 'vite';
import blitsVitePlugins from '@lightningjs/blits/vite';

// Get the preCompiler plugin
// msdfGenerator not working as expected. Raised an issue on the Blits repo
const preCompilerPlugin = blitsVitePlugins.find((item) => item.name === 'preCompiler');

/* eslint-disable no-unused-vars */
export default defineConfig(({ command, mode, ssrBuild }) => {
  return {
    base: '/', // Set to your base path if you are deploying to a subdirectory (example: /myApp/)
    plugins: [preCompilerPlugin],
    resolve: {
      mainFields: ['browser', 'module', 'jsnext:main', 'jsnext'],
    },
   ....
  };
});

Should we include msdfGenerator when building a Blits app?

@michielvandergeest
Copy link
Collaborator

@tuncayyildirtanuk Thanks for this report. From what I can tell, this error seems to be generated by the msdf-generator package and not per se by Blits. Obviously the Blits provided vite plugin is your gateway into this package, so it's still a valid issue to be aware of from the Blits perspective.

As an immediate solution / workaround, you could place the generated msdf font files (png and json) into your publics/fonts folder and reference those in the launch settings. That way the msdf generation step is skipped all together.

As for the error itself, it seems like a similar one that's been reported here: lightning-js/msdf-generator#5
That one may be related to the node version used (16 whereas, 18 is marked as minimum). Could you verify the node version used in AWS CodeBuild platform?

@tuncayyildirtanuk
Copy link
Author

Yes it is same issue like lightning-js/msdf-generator#5

Node version is 18.19.0

Screenshot 2024-07-25 at 14 58 03

Also I guess minimum node version might be 20.9.0 for the renderer perspective?

@tuncayyildirtanuk
Copy link
Author

I have updated and tried after the following change. Same issue.

Screenshot 2024-07-25 at 15 25 04

@michielvandergeest
Copy link
Collaborator

You should be able to leave your font launch setting the same, just placing the generated json and png file in the correct location alongside your ttf should be enough.

Alternatively you can specify the location to the json file and the png file explicitly, like this:

{
      family: 'lato',
      type: 'msdf',
      png: 'fonts/lato.png',
      json: 'fonts/lato.json',
},

@tuncayyildirtanuk
Copy link
Author

I have attempted the following scenarios, but the issue persists:

  1. Copied the OpenSans-Medium.msdf.json and OpenSans-Medium.msdf.png files to the public/fonts folder.
  2. Updated the launch configuration as follows:
Screenshot 2024-07-26 at 10 29 12

@tuncayyildirtanuk
Copy link
Author

Hi, I just tested via blits version 1.0.2.

I would like to share results.

CI/CD Result:

Screenshot 2024-08-05 at 12 34 37

Public font files

Screenshot 2024-08-05 at 12 35 30

Font files configuration.

Screenshot 2024-08-05 at 12 35 47

@michielvandergeest
Copy link
Collaborator

Ah, I don't think you can have 2 families with the same name in your fonts config. If you rename the msdf font to a different family name, it should work I think.

@michielvandergeest
Copy link
Collaborator

As for the font generation error, it seems like this is related to the nodeJS version (lightning-js/msdf-generator#5 (comment))

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