Fabien Huet

Fabien
Huet

Web ninja //
CTO on demand

Home Github About me

🚨 ES6 and ESNext new features are not drop-in replacements for ES5 deprecated features

in TypeScript, JavaScript

I see more and more articles telling us that we should drop our old function or var keywords to switch to the new and better () => {}, const and let. These features have many advantages and you should use them. But not as drop-in replacements.

Continue reading

🐛 TypeScript "Cannot find module './myFile..." for .scss, .less, images files, wasm...

in TypeScript, JavaScript

If you use Babel, Rollup or any compilation/bundle tool, you probably have plugins that transform your .jpg, .scss, .js, .wasm… TypeScript is only able to import files that export something explicitly. So, this error may pop in your editor when you write something like import './myStyles.scss'.

Continue reading

🔐 Authentication, ditch the username and go passwordless

in Web

Classic authentication processes with a username and a password are great except for two things: the username and the password. Here is my rant about how we can do better.

Continue reading

🎓 Webpack, loaders, Babel, sourcemaps, React, Hot Module Reload, TypeScript, modules, code splitting and lazy loading full tutorial to transpile and bundle your code

in React, JavaScript, Webpack

So many keywords in this title… The ecosystem of web development today appears complicated, and you may feel overwhelmed. So let me take you in a step-by-step tutorial to learn about each of those words and the related technologies. This article is mainly about how to use webpack to bundle your code into static assets.

TL;DR: here is the Github repo with the result. You can clone it and use it as a starter kit for single page applications with Webpack, Babel, React, TypeScript, HMR and code-splitting.

Continue reading

🤖 Complex batch updates or migration on your distant MongoDB base with a script and mongo shell

in MongoDB

If you work with a hosted MongoDB database on a DAAS (Database As A Service) like MongoDB Atlas, mLab or Compose, you often need scripting for complex operations. Like when you need to update one field in all the documents of a collection with a transformation from other fields in this document or even from different documents in other collections. A simple update is not enough.

Continue reading

☄ Redirect non-www to www in a meteor app deployed on Galaxy with SSL

in JavaScript, Meteor

You cannot have both www and non-www version because they would be considered two different sites. I root for the www version. See the yes-www arguments for this. Without https, the redirection is super easy to setup; you use URL forwarding at the DNS level. But with https this is not possible. Let’s see how to fix that.

Continue reading

🔥 Make your meteor site load FAST!

in JavaScript, Meteor

Meteor does not shine when it is serving static pages. And often, you switch to another solution. Check out their documentation , it is generated with hexo . Hexo is great, good choice. But when you are building “the fastest way to build JavaScript apps” with an amazing build tool and that you end up using another generator to build your documentation, there is room for improvement !

Continue reading

📦 Hey Adobe! Please make Illustrator Assets Export for SVGs cleaner. (I still love you)

in SVG

The Assets Export panel in Illustrator is great. It did improve my workflow a lot for PNGs. But sadly, I still have to clean up Illustrator SVGs.

Continue reading

📅 Format a Date in JavaScript

in JavaScript

[EDIT]:

Forget this article and use new Date().toLocaleDateString('fr', {day: 'numeric', weekday: 'long', month: 'long', year: 'numeric'}). The toLocaleDateString is perfect for most use.

My default choice for date formatting in JavaScript used to be Moment.js . It is a great library. A really complete solution to manage dates. I still use it server side. But 16.6k gziped, or 62.4 k with all the locales for one function ? That is way to much !

Continue reading

📅 Formater une date en Javascript

in JavaScript fr

[EDIT 2018]:

Oubliez cet article et utilisez new Date().toLocaleDateString('fr', {day: 'numeric', weekday: 'long', month: 'long', year: 'numeric'}). L’API toLocaleDateString est parfaite pour la plupart des usages.

Mon choix par défaut pour formater des dates en JavaScript a longtemps été Moment.js . C’est une solution vraiment complète pour gérer les dates ; et je l’utilise encore côté serveur. Mais 16.6k gzipé, ou 62.4 k avec toutes les locales pour une seule fonctionnalité ? C’est trop pour moi.

Continue reading