universalviewer icon indicating copy to clipboard operation
universalviewer copied to clipboard

PACKAGE_VERSION not substituted in cjs and esm builds.

Open fbessou opened this issue 1 year ago • 0 comments

UV version: 4.0.22

I'm submitting a:

  • [x] bug report => please fork one of these codesandbox examples with a repro of your issue and include a link to it below
  • [ ] feature request => please use the user stories repo
  • [ ] support request => Please do not submit support requests here, use stackoverflow

Current behavior:

The dist/esm and dist/cjs folders contain references to process.env.PACKAGE_VERSION which are not defined in a browser environment.

Expected behavior:

These environment variables shouldn't be here and should be replaced by the actual version of the universalviewer package.

Steps to reproduce:

When opening the settings dialog on https://codesandbox.io/s/uv-vite-multiple-example-sj4req?file=/src/index.js (official example), the shown version is vundefined when it should be "v4.0.22".

Related code:

Other information:

For the cjs build, since tsc doesn't allow substituting environment variables, we could do a global search and replace on the output files. For the esm build I suppose that it could be possible to configure es-build to do the substitution itself: https://esbuild.github.io/api/#define

fbessou avatar Oct 31 '23 16:10 fbessou