webpack.config.js (989B)
1 const VueLoaderPlugin = require('vue-loader/lib/plugin') 2 const exec = require("child_process").exec; 3 4 module.exports = { 5 entry: "./src/sermoni.js", 6 output: { 7 filename: "sermoni.js" 8 }, 9 module: { 10 rules: [ 11 {test: /\.js$/, use: 'babel-loader'}, 12 {test: /\.vue$/, use: 'vue-loader'}, 13 {test: /\.css$/, use: ['vue-style-loader', 'css-loader']}, 14 ] 15 }, 16 plugins: [ 17 new VueLoaderPlugin(), 18 // Ad-hoc plugin for running script automatically 19 // Thanks to https://stackoverflow.com/a/49786887 20 { 21 apply: (compiler) => { 22 compiler.hooks.afterEmit.tap("AfterEmitPlugin", (compilation) => { 23 exec("./generate.sh", (err, stdout, stderr) => { 24 if (stdout) process.stdout.write(stdout); 25 if (stderr) process.stderr.write(stderr); 26 }); 27 }); 28 } 29 } 30 ] 31 }