Giter Club home page Giter Club logo

Comments (5)

520Yanxiaofei avatar 520Yanxiaofei commented on June 2, 2024

我也遇到这个问题了,不引用cdn时,尝试引入第三方包组件时,抛出default错误
image

from repl.

guoshuangyang avatar guoshuangyang commented on June 2, 2024

local

Try to package the esm format in full, and then add the esm link in importmap. If you want to do incremental development of the components, Maybe you can listen for changes and package it in real time and server it

from repl.

itancc avatar itancc commented on June 2, 2024

我也遇到这个问题了,不引用cdn时,尝试引入第三方包组件时,抛出default错误 image

请问有解决方案了吗

from repl.

guoshuangyang avatar guoshuangyang commented on June 2, 2024

我也遇到这个问题了,不引用cdn时,尝试引入第三方包组件时,抛出default错误 image

请问有解决方案了吗

给一个最小还原的repo

from repl.

leookun avatar leookun commented on June 2, 2024

I can sort of see where you're coming from, and I'm guessing you want to provide context to the repl through a transfer function instead of a cdn.
I looked at the source code for this repository, which generates a static html with regexp, and used it as an iframe for preview. However, functions are not properly preserved in JSON.stringify, which is the main reason why the repository does not provide a function passing dependency.
Perhaps you can find a way or a plugin to make your lib output a bundle string at runtime instead of a function object, and then inject it into the final iframe as previewOptions.headHTML, you might spend some time on this

The easiest way is to write a script and put your lib artifacts into the public folder, which is probably what @vuejs/repl expects you to do

我大概明白你的想法,我猜测你希望通过传递函数而不是cdn来为repl提供上下文。
我查看了此仓库的源代码,它通过正则替换来生成一个静态的html,并将它作为预览的ifream。但是函数在JSON.stringify中不会正确保留,这也是这个仓库不提供函数传递依赖的主要原因。

或许你可以寻找一些方法或者插件,让你的lib产出运行时的bundle string,而不是函数对象,然后作为previewOptions.headHTML注入到最终的iframe中,你可能会在这上面耗费一些时间

最简单的方法是写一个脚本,把你的lib产物输入到public文件夹中,这应该也是@vuejs/repl 期望你做的

from repl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.