11 ms·
I'm not sure about React's capability with this, but Vue can very easily run with no build stage. You can load Vue from a CDN and use a couple lines of JS to po
by pricecomstock 6y ago
I'm not sure about React's capability with this, but Vue can very easily run with no build stage. You can load Vue from a CDN and use a couple lines of JS to point it at a DOM element in your app. Then you can write a plain JS Vue object (what goes inside the <script> tags in a .vue file), and all this logic will apply inside the element you pointed it at. You can also write components, although that gets a little clunky without a build stage.
This has allowed me to do things like create Vue-based tools in a locked-down corporate environment where I was not able to install Nodejs on my machine.
- bdcravens 6y agoReact can, but less ergonomically than most developers are used to.
- HonshinM 6y agoCould you comment more on how it's done?
- pier25 6y agoModern React uses JSX which is then transformed at build time into function calls. You can write those function calls yourself, but it would be a tremendous PITA.
- lhnz 6y agoIn this case, you could use `htm`: https://github.com/developit/htm#usage https://github.com/developit/htm#usage
- pier25 6y agoYeah totally. Or even use Preact by the same author which is smaller and faster than React.
- jonquest 6y agoThat's cool- but unless you're targeting greenfield browsers only you aren't going to use the syntax in that documentation without a build step or using the babel transpiler directly in the browser which, while cool from a POC standpoint, isn't a good solution. At that point you might as well just add build tools and use JSX or whatever the framework you're trying to use intended or otherwise is well documented.
- yandie 6y agoI find it amusing that you are allowed to run arbitrary Javascript but can't run NodeJS on your machine. Sometimes corporate security can be a theatre.
- RNCTX 6y agoI mean, you gotta trust someone at some point. If they don't trust Google, Microsoft, and Apple to keep Javascript in the browser sandbox-jail then they're gonna be re-inventing an awful lot of wheels ;).
- The_Colonel 6y agoFrontend JavaScript is sandboxed and you can't really disable it without crippling 90% of websites. node.js code can cripple your system way more. So this does not really seem surprising.
- barrkel 6y agoI wish we couldn't run NodeJS, then the front end devs wouldn't run this monstrosity that takes ages to start, downloads GBs of dependencies, consumes 12 cores for minutes at a time, etc. I exaggerate, but only slightly.
- runarberg 6y agoI find this attitude towards front-end developers unamuzing. If you have a beef with subset of developers in your workplace that happen to to work on the front-end, you should not take your frustration or generalize their behavior over an entire industry.
- barrkel 6y agoI don't know what it is about the Node.js ecosystem which leads to the dysfunction, but there's definitely dysfunction, and it's definitely endemic. Compiling our front end assets takes longer and more CPU than our entire back end with many multiples the amount of source code.
- shados 6y agoReact can be run from a single file from a CDN, and used without a build stage. Only catch is you don't get JSX. While by today's standard some people might consider that unacceptable, it was a fairly common way to use it when it was new (because relatively fewer teams used builds for JS back then, and JSX was far from being widely accepted). My first year of React development was without JSX even though we DID have a build step (I was categorically against it at the time. Things changed, haha).
- ht85 6y agoReact has been able to use jsx without build forever, here is a modern take: [1] The babel script is huge but it might be an option to get the ball rolling on a big upgrade. 1. https://medium.com/@to_pe/how-to-add-react-to-a-simple-html-file-a11511c0235f https://medium.com/@to_pe/how-to-add-react-to-a-simple-html-...
- shados 6y agoI mean, using Babel in the browser is essentially a build step. Your code isn't executed as is and has to be preprocessed. It's huge and slow. Not particularly viable. If your goal is just to play around, sure, but the point the Vue folks are making is that they can do the same in a way that is production friendly (maybe not scalable, but still production viable). This isn't.