Skip to content

Commit 77753ef

Browse files
Update src/lib/js/constants.js
Co-authored-by: Copilot <[email protected]>
1 parent bc9aacb commit 77753ef

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/lib/js/constants.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,17 @@
11
import pkg from '../../../package.json' with { type: 'json' }
22
import { uuid } from './common/utils/index.mjs'
33

4-
export { default as BUNDLED_SVG_SPRITE } from '../../lib/icons/formeo-sprite.svg?raw'
4+
// NOTE: The following import uses Vite's '?raw' query parameter to import the SVG as a string.
5+
// This will only work in Vite environments. In non-Vite environments, BUNDLED_SVG_SPRITE will be null.
6+
let BUNDLED_SVG_SPRITE = null;
7+
try {
8+
// Vite-specific import. Will fail in non-Vite environments.
9+
// eslint-disable-next-line import/no-unresolved
10+
BUNDLED_SVG_SPRITE = require('../../lib/icons/formeo-sprite.svg?raw');
11+
} catch (e) {
12+
// Fallback: BUNDLED_SVG_SPRITE remains null.
13+
}
14+
export { BUNDLED_SVG_SPRITE };
515

616
const name = pkg.name
717
export const version = pkg.version

0 commit comments

Comments
 (0)