Skip to content

Commit c4f4bd0

Browse files
committed
fix: svg icons not displaying in prod build
1 parent 43026d6 commit c4f4bd0

File tree

2 files changed

+2
-12
lines changed

2 files changed

+2
-12
lines changed

src/lib/js/constants.js

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

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 };
4+
export { default as BUNDLED_SVG_SPRITE } from '../../lib/icons/formeo-sprite.svg?raw'
155

166
const name = pkg.name
177
export const version = pkg.version

vite.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ const sharedConfig = {
4646
export default defineConfig({
4747
...sharedConfig,
4848
root: 'src/demo',
49-
base: process.env.NODE_ENV === 'production' ? '/formeo/' : '/',
49+
base: '/',
5050
resolve: {
5151
alias: {
5252
formeo: resolve(__dirname, 'src/lib/js/index.js'),

0 commit comments

Comments
 (0)