baidu / baidu/amis

不能在remix项目中正常使用amis组件

Open
#7,656 2 comments 0 reactions 0 assignees View on GitHub
doc need confirm
Dominant language
TypeScript
Stars
18.9k
Forks
2.7k
PR merge metrics
No merged PRs in 30d

Description

代码:
import {render as renderAsAmis} from 'amis';
const schema = {
"type": "page",
"title": "标题",
"body": "Hello World!"
};

export default function() {
return renderAsAmis(schema);
}

错误:
my-remix-app/node_modules/amis-core/lib/utils/debug.js:274
var amisHoverBox = document.createElement('div');
^
ReferenceError: document is not defined
at Object. (/home/andrew/andrew-project/kcy/my-remix-app/node_modules/amis-core/lib/utils/debug.js:274:20)
at Module._compile (node:internal/modules/cjs/loader:1254:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1308:10)
at Module.load (node:internal/modules/cjs/loader:1117:32)
at Function.Module._load (node:internal/modules/cjs/loader:958:12)
at Module.require (node:internal/modules/cjs/loader:1141:19)
at require (node:internal/modules/cjs/helpers:110:18)
at Object. (/home/andrew/andrew-project/kcy/my-remix-app/node_modules/amis-core/lib/utils/api.js:23:13)
at Module._compile (node:internal/modules/cjs/loader:1254:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1308:10)

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the Remix entry point that imports render from amis and the amis-core/lib/utils/debug.js stack trace. Reproduce the server-side render with the supplied schema and trace when document is accessed; done means the example renders in Remix without the reported ReferenceError.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.