Giter Site home page Giter Site logo

Comments (2)

fvsch avatar fvsch commented on July 29, 2024 1

The default React template is compiled by EngineBlock. It does not use Create React App, nor does it use Vite.

This project's package.json does list react-scripts from CRA in its devDependencies, but these are not used when running on StackBlitz in EngineBlock (which does not install devDependencies). They're meant for use when downloading the project outside of the StackBlitz editor (as a zip archive with the “Download Project” button in the editor, or when pushing that project to a GitHub repo with the classic editor' GitHub integration).

There are two changes we could do here, but I’m not sure which one you're referring to.

Change the devDependencies to use vite instead of react-scripts

I would welcome this change. :)

The difficulties here is that EngineBlock expects specific files to exist in the project (index.html, index.js and style.css), and combines those files into one output. Create React App works similarly. But Vite uses a different convention, and expects an index.html which should reference other resources, for instance:

<!DOCTYPE html>
<html lang="en">
<head>
  <link rel="stylesheet" href="style.css" />
  <script type="module" src="index.ts"></script>
</head>
<body>
  <div id="app"></div>
</body>
</html>

If we changed the index.html of our basic React and React+TypeScript starters, these changes would lead to HTTP requests that EngineBlock is not capable of handing, and errors in DevTools that could be puzzling for end users. It would also incentivize end users to treat those EngineBlock React projects like Vite projects, but they behave differently. That would create confusion (and bug reports ^^).

Switching the basic React starters to WebContainers + Vite

We could also switch our basic React starter templates to WebContainers, and probably use Vite then. Basically we would be making https://vite.new/react and https://vite.new/react-ts our main React starter templates.

There are some downsides to this, currently:

  • UX: for users who want a simple frontend React playground, having a Terminal with output from Vite (or some other tool) taking up space in the editor can be a distraction.
  • Performance: currently EngineBlock projects boot up quicker than WebContainers + Vite.
  • Compatibility: WebContainers do not run perfectly on memory-constrained devices, especially phones and tablets.
  • Compatibility: projects using EngineBlock are much easier to embed in blog posts, docs site, etc.

We might start using WebContainers+Vite more for basic frontend playgrounds in the future, but I doubt we'll do it in 2023.

from starters.

ArnaudBarre avatar ArnaudBarre commented on July 29, 2024

Just saw the repo name, I though this was more generic feedback tracking!

from starters.

Related Issues (9)

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.