•  
      request #45651 Use Node Import attributes to read package.json during Vite build
    Infos
    #45651
    Joris MASSON (jmasson)
    2025-12-04 13:35
    2025-12-02 17:37
    47373
    Details
    Use Node Import attributes to read package.json during Vite build

    In many vite.config.ts files, we read the package.json to mark the dependencies of a library external, which means the bundler will not include them. We rely on tsconfig.json configuration resolveJsonModule: true to read the package.json file. However, this setting also affects the production code.

    The Import attributes syntax could be used instead: it is supported for JSON since Node 20.10, so it can be used in our dev environments. Using it lets us keep resolveJsonModule only on the single case where it is actually needed in production: for the Emoji data for ProseMirror.

    Dev tools
    Empty
    Empty
    • [ ] enhancement
    • [x] internal improvement
    Empty
    Stage
    Joris MASSON (jmasson)
    Closed
    2025-12-04
    Attachments
    Empty
    References
    Referencing request #45651

    Follow-ups