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

Please add ESM export to v8 #346

Open
zoxon opened this issue Jan 20, 2025 · 3 comments
Open

Please add ESM export to v8 #346

zoxon opened this issue Jan 20, 2025 · 3 comments

Comments

@zoxon
Copy link

zoxon commented Jan 20, 2025

I try to update from v6 to v8 but have a problem with build and typescript when I try to use current CJS build
I got [ERROR] exports is not defined

microsoft/TypeScript#32934

@blakeembrey
Copy link
Member

Can you share the full error you’re getting? I have used it successfully with Vite and that linked issue doesn’t appear to be related.

@zoxon
Copy link
Author

zoxon commented Jan 23, 2025

I'm using it with astro. Astro build on vite

Here is the logs part releated to error

  vite:resolve 0.20ms path-to-regexp -> /Users/zoxon/app/node_modules/path-to-regexp/dist/index.js +1ms
  vite:resolve 0.20ms ufo -> /Users/zoxon/app/node_modules/ufo/dist/index.mjs +0ms
  vite:import-analysis 0.40ms [6 imports rewritten] src/core/routes/helpers.ts +2ms
  vite:transform 1.04ms /src/core/routes/helpers.ts +2ms
  vite:load 0.11ms [fs] ../../node_modules/path-to-regexp/dist/index.js +2ms
  vite:import-analysis 0.07ms [no imports] /Users/zoxon/app/node_modules/path-to-regexp/dist/index.js +1ms
  vite:transform 0.15ms [skipped] ../../node_modules/path-to-regexp/dist/index.js +1ms
  astro:vite Error when evaluating SSR module /Users/zoxon/app/src/pages/[...region]/[...lang]/market/[...ticker].astro:
  astro:vite |- ReferenceError: exports is not defined
  astro:vite     at eval (/Users/zoxon/app/node_modules/path-to-regexp/dist/index.js:4:23)
  astro:vite     at ESModulesEvaluator.runInlinedModule (file:///Users/zoxon/app/node_modules/astro/node_modules/vite/dist/node/module-runner.js:1057:6)
  astro:vite     at SSRCompatModuleRunner.directRequest (file:///Users/zoxon/app/node_modules/astro/node_modules/vite/dist/node/module-runner.js:1271:82)
  astro:vite     at SSRCompatModuleRunner.directRequest (file:///Users/zoxon/app/node_modules/astro/node_modules/vite/dist/node/chunks/dep-BJP6rrE_.js:30789:35)
  astro:vite     at SSRCompatModuleRunner.cachedRequest (file:///Users/zoxon/app/node_modules/astro/node_modules/vite/dist/node/module-runner.js:1166:28)
  astro:vite     at request (file:///Users/zoxon/app/node_modules/astro/node_modules/vite/dist/node/module-runner.js:1215:79)
  astro:vite     at async eval (/Users/zoxon/app/src/core/routes/helpers.ts:6:31)
  astro:vite     at async ESModulesEvaluator.runInlinedModule (file:///Users/zoxon/app/node_modules/astro/node_modules/vite/dist/node/module-runner.js:1049:5)
  astro:vite     at async SSRCompatModuleRunner.directRequest (file:///Users/zoxon/app/node_modules/astro/node_modules/vite/dist/node/module-runner.js:1271:61)
  astro:vite     at async SSRCompatModuleRunner.directRequest (file:///Users/zoxon/app/node_modules/astro/node_modules/vite/dist/node/chunks/dep-BJP6rrE_.js:30789:23)
  astro:vite  +0ms
08:55:27 [ERROR] exports is not defined
  Location:
    /Users/zoxon/app/Users/zoxon/app/node_modules/path-to-regexp/dist/index.js:4:23
  Stack trace:
    at eval (/Users/zoxon/app/node_modules/path-to-regexp/dist/index.js:4:23)
    at SSRCompatModuleRunner.directRequest (file:///Users/zoxon/app/node_modules/astro/node_modules/vite/dist/node/module-runner.js:1271:82)
    at SSRCompatModuleRunner.cachedRequest (file:///Users/zoxon/app/node_modules/astro/node_modules/vite/dist/node/module-runner.js:1166:28)
    at async eval (/Users/zoxon/app/src/core/routes/helpers.ts:5:1)
    at async SSRCompatModuleRunner.directRequest (file:///Users/zoxon/app/node_modules/astro/node_modules/vite/dist/node/module-runner.js:1271:61)
  vite:time 1003.67ms /api/market?secondary=Usd +0ms

@bjohansebas
Copy link

Hi @zoxon, I'm not sure if I can help you completely, but you can check out this repository of mine, where I got path-to-regex@8 to work. Maybe it can help you.

https://github.com/bjohansebas/playground-router

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants