使用以下语句使用最新的 sapper、svelte、nodeJS 和 rollup 堆栈注册自定义元素时未捕获的承诺。
REPL 示例:https : //svelte.dev/repl/489ee8acd10848b0bb1feb2535bd6cc5?version = 3.16.5本地创建
<svelte:options tag="parlax-background" />
& rollup.config.js
export default {
client: {
input: config.client.input(),
output: config.client.output(),
plugins: [
replace({...})
svelte({
dev: !production,
customElement: true,
// and tried also with customElement: { tag: "my-element"}
hydratable: true,
emitCss: true
Run Code Online (Sandbox Code Playgroud)
我想提一下,我已经在一个新项目上进行了测试
日志
[Client Side]
=> Uncaught (in promise) TypeError: Illegal constructor
at new SvelteElement (index.mjs:1381)
[Server Side]
=> The 'tag' option is used when generating a custom element. Did you forget …Run Code Online (Sandbox Code Playgroud)