如何为 express.js 应用程序设置 webpack,而不是 React 应用程序?

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

我需要使用 Express.js、jade 和 less 创建应用程序,并希望 assemble 使用 webpack 捆绑应用程序。 整个互联网上到处都是关于为 React 设置 webpack 的文章,但没有一篇关于使用模块化 javascript.

为通常的 express 应用程序设置它的文章

也没有一篇文章介绍如何从 .less 文件制作 common.css

请帮帮我!

  • 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".  
    

使用 !

的独立装载机

查看 webpack 文档中的配置 API 以获取有关如何设置捆绑过程的示例。这只是定义您的入口点和目的地的问题。

如果您正在寻找自动刷新功能,请查看 webpack 开发服务器 API。