Skip to content

Add preact-cli as default dependency in Preact Template #1034

@Saeris

Description

@Saeris

When you create a new project using the Preact template, it's default dependencies are only preact and preact-compat, here's an example of what the default package.json for a new Preact template project looks like:

{
  "name": "n4qn6vrz54",
  "version": "1.0.0",
  "description": "",
  "keywords": [],
  "main": "index.js",
  "dependencies": {
    "preact": "8.2.5",
    "preact-compat": "3.17.0"
  }
}

This is a problem because as stated in the GitHub import documentation, preact-cli is required as a dependency to infer the right template to use. Without it, CodeSandbox defaults to create-react-app as it's template instead, which causes all sorts of "Could not resolve dependency 'react' realtive to..." errors. I discovered this after building a new project in CodeSandbox using the Preact template, saving it to a new repository on GitHub, which when re-imported to CodeSandbox it defaulted to the React template instead.

I would open a PR for this myself if I could find out where default dependencies are listed for each of the templates. It isn't quite clear from the source code I found under packages/common/templates/ as to where those might be located.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions