How to make the drum handle of LESS files?

I have an isomorphic React application with custom server-side rendering using NodeJS. I use Babel and Webpack, which work very well, except for one problem:

Babylon cannot process require('somefile.less').

For this reason, I use Webpack to compile both the backend and frontend code, since Webpack has good CSS and LESS loaders, and it doesn't worry when viewing CSS or LESS files. However, this approach has its own problem:

Server uptime is increasing since webpack must compile the entire backend first.

This is fine when I deploy code for production, but in a development environment it really impairs performance.

babel-nodeA utility, on the other hand, compares very quickly, if only I can get it to process CSS / LESS files. Hence my question: can we get Babel to work with CSS / LESS files?

+4
source share

Source: https://habr.com/ru/post/1676549/


All Articles