Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: fresh vendor dependencies #1008

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

tlgimenes
Copy link
Contributor

What's the purpose of this PR?

This PR solves issues related to running deno vendor on a fresh project.

How does it work?

Vendoring in fresh is a little bit more difficult than in a "normal" deno project because it uses esbuild and, sometimes, dependency resolution is not accessible to deno's engine. To overcome this issue, I'm using a technique of explicitly configuring deno's engine to vendor dependencies by using the dynamic import tag. The upside of this approach is not actually importing the dependency but only configuring the vendoring engine to include this dependency.

This PR fixes both fresh's and twind's plugin missing modules.

How to test it?

To test it, clone this version, link to a newly created fresh project and run:

deno vendor main.ts dev.ts
deno run -A --no-remote main.ts

The server should be spawned without any issues.

@deer
Copy link
Contributor

deer commented Nov 29, 2023

@marvinhagemeister, this is already working for me with fresh 1.5.4 and deno 1.38.3.

  • deno run -Ar https://fresh.deno.dev
  • cd vendor_test
  • deno vendor main.ts dev.ts
  • (delete imports from deno.json because "importMap": "./vendor/import_map.json" was added)
  • deno run -A --no-remote dev.ts

Then I get:

The manifest has been generated for 5 routes and 1 islands.

 🍋 Fresh ready
    Local: http://localhost:8000/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants