xstevenyung / fresh-seo

The fastest way ⚡️ to create sitemap and robots.txt in your Deno Fresh project 🍋
MIT License
48 stars 5 forks source link

DayJS ESM Import Causing Dependency Conflicts #16

Closed heyitsjoealongi closed 1 year ago

heyitsjoealongi commented 2 years ago

After running the setup I get errors with the DayJS Import. If I add this to the import map, the issues continue with "fresh/server.ts".

Console: Task start deno run -A --watch=static/,routes/ dev.ts Watcher Process started. The manifest has been generated for 16 routes and 0 islands. error: Uncaught (in promise) TypeError: Relative import path "dayjs" not prefixed with / or ./ or ../ and not in import map from "https://deno.land/x/fresh_seo@0.1.1/src/sitemap.ts" at https://deno.land/x/fresh_seo@0.1.1/src/sitemap.ts:7:17 await import(entrypoint); ^ at async dev (https://deno.land/x/fresh@1.1.1/src/dev/mod.ts:187:3) at async file:///Users/collectedview/Documents/GitHub/collectedview2023/collectedview/dev.ts:5:1 Watcher Process finished. Restarting on file change...

heyitsjoealongi commented 2 years ago

I think this change to Fresh may be the issue, https://deno.land/x/fresh@1.1.1/server.tsx is now https://github.com/denoland/fresh/blob/main/server.ts

sinyo-matu commented 2 years ago

Maybe We can just remove Dayjs from dependencies? For now, we're only using format function of Dayjs Object, but we could just accomplish it with Date.prototype.toISOString()

notangelmario commented 2 years ago

Hi, @collectedview! The error you provided indicates usage of an old version of fresh-seo. This bug has been addressed by a25d31c9cd05aaa35df63707f4743aff88e45c0b. Check your dependecies again and let us know if we need to look further. Maybe try running your project with the -r deno flag?

@sinyo-matu I think that would be a great idea. Mind submitting a pull request?

heyitsjoealongi commented 2 years ago

@notangelmario so from a fresh install of "fresh-seo" with "dayjs" as part of the import map, I can install and run with deno run --allow-net --allow-read --allow-env --allow-run --watch=static/,routes/ main.ts allows the runtime to proceed, if dayjs is in the import_map.

Running Fresh with deno task start invokes the error. It seems to be based on the permissions of Deno along with "dayjs" dependency that cause the error, there is probably more too it, I only recently started looking at deno modules.

I know I had issues before with .toISOString() with Node on windows, I am not sure if that carries over to Deno, but a heads up.

notangelmario commented 2 years ago

Trybagain running deno -Ar --watch=static/,routes/ main.ts

gutenfries commented 1 year ago

(@xstevenyung): Please consider closing as this was fixed with #19