You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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:
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.
Activity
ArnaudBarre commentedon Aug 30, 2023
Just saw the repo name, I though this was more generic feedback tracking!
fvsch commentedon Sep 4, 2023
The default React template is compiled by EngineBlock. It does not use Create React App, nor does it use Vite.
This project's
package.jsondoes listreact-scriptsfrom CRA in itsdevDependencies, 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
devDependenciesto useviteinstead ofreact-scriptsI would welcome this change. :)
The difficulties here is that EngineBlock expects specific files to exist in the project (
index.html,index.jsandstyle.css), and combines those files into one output. Create React App works similarly. But Vite uses a different convention, and expects anindex.htmlwhich should reference other resources, for instance:If we changed the
index.htmlof 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:
We might start using WebContainers+Vite more for basic frontend playgrounds in the future, but I doubt we'll do it in 2023.