mirror of
https://github.com/citizenfx/cfx-server-data.git
synced 2025-12-12 06:14:09 +01:00
builders: webpack resource builder
This commit is contained in:
26
resources/[system]/[builders]/webpack/webpack_runner.js
Normal file
26
resources/[system]/[builders]/webpack/webpack_runner.js
Normal file
@@ -0,0 +1,26 @@
|
||||
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, {});
|
||||
});
|
||||
};
|
||||
Reference in New Issue
Block a user