Skip to content

error in production mode #82

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

Closed
uwni opened this issue Jan 11, 2021 · 4 comments
Closed

error in production mode #82

uwni opened this issue Jan 11, 2021 · 4 comments
Labels
✘ bug Something isn't working

Comments

@uwni
Copy link

uwni commented Jan 11, 2021

deno console:

satanya@iMac:~ ➜ aleph init hello
INFO Downloading template...
INFO Saving template...
INFO Done
INFO ---
INFO Aleph.js is ready to Go.
INFO $ cd hello
INFO $ aleph dev    # start the app in `development` mode
INFO $ aleph start  # start the app in `production` mode
INFO $ aleph build  # build the app to a static site (SSG)
INFO ---
satanya@iMac:~ ➜ cd hello
satanya@iMac:hello ➜ aleph start
INFO Download https://esm.sh/react • https://esm.sh/[email protected]?target=es2015
INFO Download https://cdn.esm.sh/v14/[email protected]/es2015/react.js 
INFO Download https://deno.land/x/aleph/mod.ts • https://deno.land/x/[email protected]/mod.ts
INFO Download https://deno.land/x/aleph/aleph.ts • https://deno.land/x/[email protected]/aleph.ts
INFO Download https://deno.land/x/aleph/context.ts • https://deno.land/x/[email protected]/context.ts
INFO Download https://deno.land/x/aleph/error.ts • https://deno.land/x/[email protected]/error.ts
INFO Download https://deno.land/x/aleph/head.ts • https://deno.land/x/[email protected]/head.ts
INFO Download https://deno.land/x/aleph/util.ts • https://deno.land/x/[email protected]/util.ts
INFO Download https://deno.land/x/aleph/events.ts • https://deno.land/x/[email protected]/events.ts
INFO Download https://deno.land/x/aleph/routing.ts • https://deno.land/x/[email protected]/routing.ts
INFO Download https://deno.land/x/aleph/hooks.ts • https://deno.land/x/[email protected]/hooks.ts
INFO Download https://deno.land/x/aleph/import.ts • https://deno.land/x/[email protected]/import.ts
INFO Download https://deno.land/x/aleph/link.ts • https://deno.land/x/[email protected]/link.ts
INFO Download https://deno.land/x/aleph/bootstrap.ts • https://deno.land/x/[email protected]/bootstrap.ts
INFO Download https://esm.sh/react-dom • https://esm.sh/[email protected]?target=es2015
INFO Download https://cdn.esm.sh/v14/[email protected]/es2015/react-dom.js 
INFO Download https://deno.land/x/aleph/nomodule.ts • https://deno.land/x/[email protected]/nomodule.ts
INFO Download https://deno.land/x/aleph/tsc/tslib.js • https://deno.land/x/[email protected]/tsc/tslib.js
INFO Download https://deno.land/x/aleph/renderer.ts • https://deno.land/x/[email protected]/renderer.ts
INFO Download https://esm.sh/react-dom/server • https://esm.sh/[email protected]/server?target=es2015
INFO Download https://cdn.esm.sh/v14/[email protected]/es2015/server.js 
INFO Aleph.js v0.2.27
INFO - Global
INFO   ✓ Custom App
INFO Server ready on http://localhost:8080
WARN can't get the module by path '/_aleph/-/deno.land/x/aleph/hmr.js(//deno.land/x/aleph/hmr)'

browser console:
圖片

OS: macOS 11 Big Sur

the hello project can work when run aleph dev

ije added a commit that referenced this issue Jan 11, 2021
@ije ije added the ✘ bug Something isn't working label Jan 11, 2021
ije added a commit that referenced this issue Jan 11, 2021
@ije
Copy link
Member

ije commented Jan 11, 2021

fixed, please upgrade the aleph cli and try again, thanks!

aleph upgrade

@uwni
Copy link
Author

uwni commented Jan 11, 2021

thanks.
btw, I am facing a new problem that how to use Dynamic Routes.
I don't know how to read the parameters from the URL that the user inputs.
for example the server hosts:
pages/blog/[slug].tsx
and user access the server by pages/blog/:something

How to let the component exported by [slug].tsx knows the parameter "something". I have tried the parameters

{ Page, pageProps }: { Page: ComponentType<any>, pageProps: any }

but not work

@ije
Copy link
Member

ije commented Jan 11, 2021

you may need the useRouter hook:

import { useRouter } from "https://deno.land/x/[email protected]/mod.ts"

// hypothetically current location patname is '/post/hello-world?theme=dark'
export default function Page() {
  const {
    pathname, // string, sholud be '/post/hello-world'
    pagePath, // string, sholud be '/post/[slug]'
    params,   // object, sholud be {slug: 'hello-world'}
    query     // URLSearchParams, `query.get('theme')` sholud be 'dark'
  } = useRouter()
  ...
}

@uwni
Copy link
Author

uwni commented Jan 11, 2021

thanks ❤️

@uwni uwni closed this as completed Jan 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
✘ bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants