Giter Site home page Giter Site logo

Comments (9)

dillionverma avatar dillionverma commented on August 20, 2024

I added a commit which triggers this issue here

magicuidesign/magicui@0b127bb

from velite.

zce avatar zce commented on August 20, 2024

Based on your description, it seems that this has nothing to do with Velite.

Anyway, I will try to reproduce the problem you mentioned first.

from velite.

zce avatar zce commented on August 20, 2024

I think I know what the problem is.

I need some time to see if there is a better solution.

from velite.

dillionverma avatar dillionverma commented on August 20, 2024

a similar issue also occurred with another component in the registry which I completely removed called "wavy-dot-pattern" and these issues didn't occur with contentlayer which led me to believe it was something to do with the way velite is bundling / rendering the markdown

from velite.

zce avatar zce commented on August 20, 2024

Yes, the reason is that I stopped bundling third-party libraries in the velite.config.ts in a previous version, which is different from contentlayer

#62

Please wait for me for a moment

from velite.

zce avatar zce commented on August 20, 2024

A brief explanation of the cause of the problem: In the reference files of velite.config.ts, some modules not intended for the Node.js runtime were imported using dynamic import, and these imports are unrelated to the operation of Velite.

However, the esbuild used internally by Velite tries to bundle and execute these modules, which are not for the Node.js runtime, leading to the issue.

Although Velite can ignore the bundling of these modules by specifying esbuild's external configuration option, like this: external: ["@/registry"], I believe this is not a common scenario, so I don't plan to support custom external. For detailed reasons, refer to #62.

I personally think there are two solutions to this problem:

  1. Remove the dynamic import from the relevant files: magicuidesign/magicui#190
  2. Prepare a separate configuration module for the rehype plugin, but this requires keeping the files in sync, so it's not recommended.

Since the original codebase seems to be missing some files, the PR is not yet complete. If you agree with my view, I can try to improve it when I have time.

from velite.

dillionverma avatar dillionverma commented on August 20, 2024

thanks for prompt responses!

i took a quick look at the PR and think it should theoretically work

I also prefer option 1 instead of having to maintain the two separate files

image image

tried to test locally but noticed specific pages weren't running

im not too familiar with the lower level details lazy components yet - any idea what might be going on here?

from velite.

zce avatar zce commented on August 20, 2024

Note my usage in PR:

const Component = lazy(() => import(`@/registry/components/examples/${component}`))

You cannot extract this path into a variable, as this will prevent the compiler from finding it properly.

from velite.

zce avatar zce commented on August 20, 2024

@dillionverma If there are no more questions, I will close this issue.

from velite.

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.