node.js - 如何在webpack构建完成后执行我的一些nodejs代码
迷茫
迷茫 2017-04-17 15:02:30
0
2
552

webpack有类似如下的api吗

webpack.on("after-emit",function(){
  //我的代码
  //...
});

在webpack构建完成后,我需要执行一些移动文件的操作,将源码中指定的文件移动到生成的文件夹中,请问应该怎么做?

迷茫
迷茫

业精于勤,荒于嬉;行成于思,毁于随。

reply all(2)
左手右手慢动作

You can use npm scripts, npm run webpack && npm run copy

巴扎黑

webpack itself provides Node.js api, which can be started in a script:

var webpack = require("webpack");

// returns a Compiler instance
webpack({
    // configuration
}, function(err, stats) {
    // ...
});

Then you can move on to other things

So you can write the startup of webpack and other required operations in the same script, and then run the script directly in the console

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template