Hacker News new | ask | show | jobs
by wolco 2430 days ago
The complexity comes from getting the tooling installed now and packages.

If I can't just include a file things are going to get more complex.

State machines are a method to solve a problem that could be expressed in other ways to make it fit the language better.

2 comments

> If I can't just include a file things are going to get more complex.

But the tooling and npm packages are all optional. You can import React from a CDN and use stuff like htm [1] or domz [2] instead of a JSX compilation step.

Or you can use Vue instead of React (their tutorial starts by using Vue via CDN).

If you're able to only support 95% of the browsers, you can use most modern ES6 features, including ES Modules and async/await.

If you still need the tooling, there are options like Parcel [3] or Poi.js [4] that require zero configuration. You don't really need the complexity of Webpack.

--

[1] https://www.npmjs.com/package/htm

[2] https://www.npmjs.com/package/domz

[3] https://www.npmjs.com/package/parcel

[4] https://www.npmjs.com/package/poi

I've used vue by including it. I've used react by including it and babel.

When I tried to include other packages they were only available through npm (some had cdn versions but most did not). You don't get access to the entire ecosystem without the tooling.

You can use a site like https://unpkg.com/ to include files from most npm packages using a script tag.
What is complex about the tooling?

If I want to implement a rich text editor in my website, it will be as easy as 'npm install ...' and an import statement in the relevant file.

Is there an advantage to make a state machine to solve this?