1
0
mirror of https://github.com/citizenfx/cfx-server-data.git synced 2025-01-12 01:03:14 +08:00
cfx-server-data/resources/[system]/[builders]/webpack/webpack_runner.js
2018-10-03 16:57:57 +02:00

26 lines
505 B
JavaScript

const weebpack = require('webpack');
const path = require('path');
module.exports = (inp, callback) => {
const config = require(inp.configPath);
config.context = inp.resourcePath;
if (config.output && config.output.path) {
config.output.path = path.resolve(inp.resourcePath, config.output.path);
}
weebpack(config, (err, stats) => {
if (err) {
callback(err);
return;
}
if (stats.hasErrors()) {
callback(null, stats.toJson());
return;
}
callback(null, {});
});
};