I’ve finally decided to do that step and move from my old school JS workflow to a trendy modern one - which means I need to install npm, webpack, babel and who knows what else. Most of that stuff was unfamiliar to me so I’ve tried to understand the whole process of creating a Node project by doing it myself… but I failed. What went wrong?

Setting up a node

Installing and setting up node was an easy task. I’ve used nvm which is conceptually pretty similar to pyenv and the latter tool I’m using for quite a time now. And then the troubles started.

I must admit Webpack (and it’s plugins) is a really weird tool to use. Maybe it’s me being silly, I’m not sure at this anymore. My opinion on it is: too good to leave, too bad to stay. And the staying part I definitely owe to vue-cli which generated all the wicked configuration files and a project structure for me. I’ve made some minor changes in a package.json but was afraid to tweak it even more. Now I finally understand how an elderly person unfamiliar with using a computer may feel like when in need to perform a little bit more harder operation.

Npm’s errors are very verbose but at the same time are giving a little of information about the cause of an error. For instance: accidentally I tried to run a second node development server and from logs I couldn’t read that the failure is due to a port being already in use, I only was noticed that it is probably not a problem with node but my package. Touché.

After I finally created a node project I was able to move one of my Vue components from a regular JS and a HTML template to a separate .vue file. That was not a bad experience at all. Vue compiler is by far much more helpful than node logs. Or maybe that was some of webpack plugin? Dunno. Anyway, it was very supportive.

As a summary I can only write one sentence: JavaScript ecosystem feels to be overcomplicated and/or overengineered for me. Me, who was mostly using jQuery (with plugins stored inside vendor directory) for years and didn’t face any major problems with it. I’m really looking forward to see what my point would be after working with node for some time.

Where are unit tests?

The sad point about transforming my UI to a node project is it reminded me that JavaScript is also a code which needs to be tested. My original idea was to write tests just after configuring webpack and other stuff - like Travis - but it took me so long I had to postpone my rather amibitous plan. To my surprise, codecov.io recognized I’m now using node in Łapka without any additional configuration and reported a significant drop in a coverage from 100% down to 82%. Well, I should have seen that coming.

I will fix it in future pushes, I promise.