fix(web): editor.html CSS 改 import 进 bundle,修生产构建 404

editor.html 三条 /node_modules/*.css 绝对 link 在 vite build 后不入 dist,
preview/静态托管下 404 → 设计器裸样式。改由 src/editor/main.tsx import,
rollup 收集进 dist/assets/*.css。dev 不受影响(vite 转译同源)。
注:amis-ui/amis-editor-core 的 exports 字段不暴露 css 子路径,裸包名 import 被 rollup 拒绝,
故用相对 node_modules 路径直引真实 css 文件。
REQUIRED-before-any-hosted-demo, OPTIONAL-for-pure-dev。

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-20 09:33:34 +08:00
parent 690f4c755e
commit ae0155eb2c
2 changed files with 11 additions and 4 deletions

View File

@@ -5,10 +5,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>EIP4 页面设计器</title>
<!-- amis-editor 独立入口:用 npm 包版 amis,与主应用 sdk-local 完全隔离 -->
<!-- CSS 在 HTML 里直接引用,绕开 vite esbuild 对 amis-ui 包路径的解析 -->
<link rel="stylesheet" href="/node_modules/amis-editor-core/lib/style.css" />
<link rel="stylesheet" href="/node_modules/amis-ui/lib/themes/default.css" />
<link rel="stylesheet" href="/node_modules/amis-ui/lib/helper.css" />
<!-- CSS 由 src/editor/main.tsx import 引入(vite build 收集进 dist,避免绝对包路径在生产构建 404)-->
<style>
html, body, #editor-root { height: 100%; margin: 0; overflow: hidden; }
/* amis-editor 自带 CSS 未把 .ae-Editor 约束到容器高度 → 它按内容自然撑高(高页面如