Vadim
Vadim

Reputation: 3794

How to setup webpack for express.js application, not react app?

I need to create application with Express.js, jade and less and want to assemble application in bundles with webpack. Whole internet is full of articles about setup webpack for react but no one about setting up it for usual express application with modular javascript.

There is also no one article about how to make common.css from .less files

Help me please!

Upvotes: 5

Views: 513

Answers (1)

tells
tells

Reputation: 630

  • https://github.com/webpack/less-loader
  • https://github.com/webpack/jade-loader

    require("jade!./template.jade");  
    // => uses the "jade-loader" (that is installed from npm to "node_modules")  
    //    to transform the file "template.jade"  
    
    require("!style!css!less!bootstrap/less/bootstrap.less");  
    // => the file "bootstrap.less" in the folder "less" in the "bootstrap"  
    //    module (that is installed from github to "node_modules") is  
    //    transformed by the "less-loader". The result is transformed by the  
    //    "css-loader" and then by the "style-loader".  
    

separate loaders with !

check out the configuration API in the webpack docs for examples on how to set up the bundling process. It's just a matter of defining your entry points and your destination.

If you're looking for auto-refreshing look at the webpack dev server API.

Upvotes: 1

Related Questions