GithubHelp home page GithubHelp logo

create-preact's People

Contributors

hillsie avatar jovidecroock avatar rschristian avatar rxliuli avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

rxliuli mbrukman

create-preact's Issues

`vike-preact` package - Vike+Preact collaboration

Hi Preact team, Aurélien from @vikejs here. We saw that create-preact is scaffolding projects with Vike, which is really nice.

Instead of maintaining your own Vike hooks here in your templates, we recommend moving them to a Vike extension named vike-preact. Your templates could then just scaffold projects having vike and vike-preact in their package.json.

We (Preact and Vike) could then for example co-maintain together this new vike-preact package shipping the hooks. And vike-preact could be used in other scaffolders, like https://github.com/batijs/bati

Let us know if you're interested in this collaboration. This would mean less maintenance work for you and less chances of mistakes if we co-maintain these hooks.

CC @brillout @magne4000

Issue with conflicting contexts when they share a variable name

Describe the bug

When using npm init preact to set up a project, a conflict arises when multiple contexts are defined using the same variable name. Even if these contexts are created in separate files, if they are assigned to the same variable name, they seem to override each other. This only happens when running npm run dev, not when running npm run build or npm run preview.

To Reproduce

I created a minimal example exhibiting this behavior: https://github.com/rjvdw/preact-context-bug. Foo.jsx, Bar.jsx and Baz.jsx all define their own context. Foo.jsx and Bar.jsx use const ctx = createContext, whereas Baz.jsx uses const ctxBaz = createContext.

Expected behavior

When running this app, you are presented with three buttons. I would expect each button to only increment the counter directly next to this button, but instead the counters for Foo.jsx and Bar.jsx are linked. I.e. when I increment Foo, Bar is also incremented and vice versa. The counter for Baz is working as intended.

Add router as valid SSG option

Right now we only support adding a router to pure client-side apps but we should expand this to SSG as well. Just need to add a config/router-ssg directory I think, mirroring what we've done w/ base and config/router more or less.

Add ReadMe to template(s)

Should document the commands needed to get up and running (we also list this in the CLI output upon completion, but duplication wouldn't hurt) and possibly duplicate the resources info as well?

Failed to run `dev` on a newly created project

I used create-preact to start a project. But when I ran yarn run I got this:

VITE v4.4.9  ready in 487 ms
  ➜  Local:   http://127.0.0.1:3000/
  ➜  Network: use --host to expose
  ➜  press h to show help
Error:   Failed to scan for dependencies from entries:
  /pages/index.page.tsx
/renderer/_default.page.client.tsx

  ✘ [ERROR] Expected ">" but found "value"

    renderer/usePageContext.ts:13:27:
      13 │   return <Context.Provider value={pageContext}>{children}</Context...
         │                            ~~~~~
         ╵                            >

And when I tried to go to localhost I got this:

14:59:08 [vite-plugin-ssr][request(1)] HTTP request: /
14:59:09 [vite][request(1)] Failed to transpile /renderer/usePageContext.ts because:
Unexpected token, expected "," 
  11 |
  12 | function PageContextProvider({ pageContext, children }) {
> 13 |   return <Context.Provider value={pageContext}>{children}</Context.Provider>
     |                  ^
  14 | }
  15 |
  16 | function usePageContext() {
┌───────────────────────────────┐
│ Error isn't helpful? See https://vite-plugin-ssr.com/errors#verbose │
└───────────────────────────────┘
14:59:09 [vite-plugin-ssr][request(1)][Warning] No _error.page.js found, we recommend defining an error page, see https://vite-plugin-ssr.com/error-page
14:59:09 [vite-plugin-ssr][request(1)] HTTP response / ERR

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.