Skip to content

Commit 61b63da

Browse files
committed
Merge develop into master
2 parents 2d39b18 + fa6e1b7 commit 61b63da

2 files changed

Lines changed: 31 additions & 55 deletions

File tree

apps/element-demo/src/app.html

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,6 @@
44
<meta charset="utf-8" />
55
<link rel="icon" href="%sveltekit.assets%/pie-logo-orange.svg" type="image/svg+xml" />
66
<meta name="viewport" content="width=device-width, initial-scale=1" />
7-
<script type="module">
8-
import RefreshRuntime from '/@react-refresh';
9-
RefreshRuntime.injectIntoGlobalHook(window);
10-
window.$RefreshReg$ = () => {};
11-
window.$RefreshSig$ = () => (type) => type;
12-
window.__vite_plugin_react_preamble_installed__ = true;
13-
</script>
147
%sveltekit.head%
158
</head>
169
<body data-sveltekit-preload-data="off">

apps/element-demo/vite.config.ts

Lines changed: 31 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,26 @@ export default defineConfig({
5151
/\/lib-react\/.*\.(jsx|tsx)(?:\?.*)?$/,
5252
],
5353
}),
54+
{
55+
name: 'react-refresh-preamble-dev-only',
56+
apply: 'serve',
57+
transformIndexHtml() {
58+
return [
59+
{
60+
tag: 'script',
61+
attrs: { type: 'module' },
62+
children: [
63+
"import RefreshRuntime from '/@react-refresh';",
64+
'RefreshRuntime.injectIntoGlobalHook(window);',
65+
'window.$RefreshReg$ = () => {};',
66+
'window.$RefreshSig$ = () => (type) => type;',
67+
'window.__vite_plugin_react_preamble_installed__ = true;',
68+
].join('\n'),
69+
injectTo: 'head',
70+
},
71+
];
72+
},
73+
},
5474
{
5575
name: 'serve-demo-iife-bundles',
5676
apply: 'serve',
@@ -148,8 +168,7 @@ export default defineConfig({
148168
// Do not list d3-shape here: it is not a direct dependency of this app and Vite cannot resolve it
149169
// until a charting import pulls it in (via @pie-lib/charting / recharts).
150170
include: ['react', 'react-dom', 'react/jsx-runtime'],
151-
// Exclude workspace packages and @pie-framework packages to prevent dependency scanning errors
152-
// These are marked as external in the build config
171+
// Exclude workspace packages and @pie-framework packages to prevent dependency scanning errors.
153172
exclude: ['@pie-element/*', '@pie-lib/*', '@pie-framework/*'],
154173
// Vite 8 uses Rolldown for dep optimization.
155174
// Keep controller dist files external to avoid optimizer scan issues.
@@ -158,54 +177,18 @@ export default defineConfig({
158177
},
159178
},
160179

180+
ssr: {
181+
external: ['@pie-element/element-bundler', 'lightningcss'],
182+
},
183+
161184
build: {
162185
rollupOptions: {
163-
external: (id) => {
164-
// Mark common dependencies that React and Svelte elements mark as external
165-
// These match the external configuration in element vite configs
166-
// to prevent "failed to resolve import" errors during build
167-
return (
168-
/^react($|\/)/.test(id) ||
169-
/^react-dom($|\/)/.test(id) ||
170-
/^svelte($|\/)/.test(id) ||
171-
/^@pie-lib\//.test(id) ||
172-
/^@pie-element\//.test(id) ||
173-
/^@pie-framework\//.test(id) ||
174-
/^@mui\//.test(id) ||
175-
/^@emotion\//.test(id) ||
176-
/^d3-/.test(id) ||
177-
/^@testing-library\//.test(id) ||
178-
id === 'lodash' ||
179-
/^lodash\//.test(id) ||
180-
/^styled-components/.test(id) ||
181-
id === 'konva' ||
182-
/^konva\//.test(id) ||
183-
id === 'react-konva' ||
184-
/^react-konva\//.test(id) ||
185-
/^@dnd-kit\//.test(id) ||
186-
id === '@mdi/react' ||
187-
/^@mdi\/react\//.test(id) ||
188-
id === '@mdi/js' ||
189-
/^@mdi\/js\//.test(id) ||
190-
id === 'recharts' ||
191-
/^recharts\//.test(id) ||
192-
[
193-
'prop-types',
194-
'classnames',
195-
'debug',
196-
'i18next',
197-
'humps',
198-
'mathjs',
199-
'react-jss',
200-
'js-combinatorics',
201-
'@mapbox/point-geometry',
202-
'react-transition-group',
203-
'nested-property',
204-
'pluralize',
205-
'decimal.js',
206-
].includes(id)
207-
);
208-
},
186+
external: (id) =>
187+
id === 'lightningcss/package.json' ||
188+
id === 'canvas' ||
189+
id === '@pie-element/element-bundler' ||
190+
id.startsWith('@pie-element/element-bundler/') ||
191+
id.includes('/packages/shared/bundler-shared/'),
209192
},
210193
},
211194
});

0 commit comments

Comments
 (0)