Skip to content

Importing appleDeviceSpecsForLaunchImages in Next.js breaks build on Vercel #1075

@tillschweneker

Description

@tillschweneker

Hi,
I am using the appleDeviceSpecsForLaunchImages in my Next.js application to dynamically create splash screen images for the different screen sizes. This works perfectly fine in local dev and prod builds.

Building the application on Vercel works as well, but when I launch the application I get the following 500 error:

Error: ENOENT: no such file or directory, open '/vercel/path0/node_modules/pwa-asset-generator/dist/config/apple-fallback-data.json'

I use this import statement:

import { appleDeviceSpecsForLaunchImages } from 'pwa-asset-generator'

It worked with version 7 of pwa-asset-generator, so I guess it is related to switching to ESM.

I found a workaround though, by directly importing the JSON file with the following import:

import appleDeviceSpecsForLaunchImages from 'pwa-asset-generator/dist/config/apple-fallback-data.json' with { type: 'json' } 

The type assertion using with is crucial here.

System (please complete the following information):

  • node version 22.14
  • npm version 10.9.2
  • pwa-asset-generator version 8.0.4

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingneeds verificationBug needs to be verified with reproduction

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions