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(admin): only check if app.js file exists before trying to use it #18780

Merged
merged 2 commits into from
Nov 14, 2023

Conversation

alexandrebodin
Copy link
Member

What does it do?

Upgrade the laodFile util to support required feature.

Why is it needed?

Fix an issue with custom app code

How to test it?

create a src/admin/app.(ts|tsx|js|jsx) file with jsx code in it

Related issue(s)/PR(s)

Let us know if this is related to any issue/pull request

@alexandrebodin alexandrebodin added source: core:admin Source is core/admin package pr: fix This PR is fixing a bug labels Nov 13, 2023
@alexandrebodin alexandrebodin added this to the 4.15.5 milestone Nov 13, 2023
@alexandrebodin alexandrebodin self-assigned this Nov 13, 2023
@alexandrebodin
Copy link
Member Author

@joshuaellis I'm wondering why we even bother using esbuild to load that file ? we just need it's path to generate the .strapi/app.js file I think

@joshuaellis
Copy link
Member

@joshuaellis I'm wondering why we even bother using esbuild to load that file ? we just need it's path to generate the .strapi/app.js file I think

I don't think we need to in retrospective, although in the future we might want to run validations against it but we can do that another time. I think using pathExists from the files.ts will suffice to assert it's the file we expect :)

@alexandrebodin alexandrebodin merged commit b01df70 into releases/4.15.5 Nov 14, 2023
22 checks passed
@alexandrebodin alexandrebodin deleted the fix/load-app-custom branch November 14, 2023 10:56
@joshuaellis joshuaellis changed the title fix(admin): load app custom with jsx and allow more extensions fix(admin): only check if app.js file exists before trying to use it Nov 14, 2023

if (configFile) {
return { path: filePath, config: configFile };
if (fs.existsSync(filePath)) {

Choose a reason for hiding this comment

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

Why use existsSync in async function ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr: fix This PR is fixing a bug source: core:admin Source is core/admin package
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants