New SPA frameworks like React, Angular, Vue etc. Requires running node js server. But is there any way to run "output" (code generated after transpilation step) without running any server, directly in browser ? Just like we used to do with jQuery?

I know there are workaround projects are available like preact, petite Vue etc. Which doesn't require node or any compilation step. But, they feel with less features, and clumsy syntax. I want same features, but want to test final output without nodejs, directly in browser. Is that possible?

2 Replies 2

You can do it using proxy and larvel server,,, intercepted larvel request in spa ,,,

Please, clarify your difficulty, because currently it appears that the question is based on a false premise.

You mention transpilation like it's not a problem, but it already requires Node. Node is generally needed to build an app. The mentioned frameworks are designed to use a build step. Although this means that no build step results in worse DX or lacking features, it's possible to write vanilla JS code and avoid it at all:

Build step also involves module bundling, the alternative is to use native ES modules. Framework ecosystem can prevent this usage if third-party libraries weren't designed for the use without a build step. Workarounds like esm.sh can be used.

Node is also needed for a dev server. Without it, a project needs to be fully transpiled to be previewed if it uses a build step.

Node is not needed to run the output. The result of a build step in most setups (Vite, etc) is dist folder that contains static files that can be deployed to a web server that serves them (doesn't have to be Node) or be opened directly in a browser. The latter usage puts restrictions because some features require an application to use a web server, most commonly a router that uses History API. In order to overcome it, hash routing strategy can be used instead.

Lastly, Node is required to use SSR with the frameworks. For an application with infrequently changed server-side data, SSR can be replaced with SSG. Astro, Vite plugin or framework-specific SSG platform can be used. Again, the result is dist folder that can be either deployed to a web server or opened in a browser.

It's true that some frameworks are designed to be used with no build step. Alpine is a popular one. Although it's marketed as a modern jQuery replacement, it's heavily inspired by AngularJS (1.x) and Vue 1/2 (and uses Vue 3 reactivity under the hood).

Your Reply

By clicking “Post Your Reply”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.