2021-04-13 23:46:54 +02:00
|
|
|
const webpack = require('webpack');
|
2021-09-08 20:54:52 +02:00
|
|
|
//const ora = require('ora');
|
2023-10-05 03:42:57 +02:00
|
|
|
const {rimraf} = require('rimraf');
|
|
|
|
//const chalk = require('chalk');
|
2021-04-13 23:46:54 +02:00
|
|
|
const config = require('./webpack.config.js');
|
|
|
|
|
|
|
|
const env = process.env.NODE_ENV || 'development';
|
|
|
|
const target = process.env.TARGET || 'web';
|
|
|
|
const isCordova = target === 'cordova'
|
|
|
|
|
2021-09-08 20:54:52 +02:00
|
|
|
//const spinner = ora(env === 'production' ? 'building for production...' : 'building development version...');
|
|
|
|
//spinner.start();
|
2021-04-13 23:46:54 +02:00
|
|
|
|
2023-10-05 03:42:57 +02:00
|
|
|
rimraf(isCordova ? './cordova/www' : './www/').then(() => {
|
|
|
|
//if (removeErr) throw removeErr;
|
2021-04-13 23:46:54 +02:00
|
|
|
|
|
|
|
webpack(config, (err, stats) => {
|
|
|
|
if (err) throw err;
|
2021-09-08 20:54:52 +02:00
|
|
|
//spinner.stop();
|
2021-04-13 23:46:54 +02:00
|
|
|
|
|
|
|
process.stdout.write(`${stats.toString({
|
|
|
|
colors: true,
|
|
|
|
modules: false,
|
|
|
|
children: false, // If you are using ts-loader, setting this to true will make TypeScript errors show up during build.
|
|
|
|
chunks: false,
|
|
|
|
chunkModules: false,
|
|
|
|
})}\n\n`);
|
|
|
|
|
|
|
|
if (stats.hasErrors()) {
|
2023-10-05 03:42:57 +02:00
|
|
|
console.log('Build failed with errors.\n');
|
2021-04-13 23:46:54 +02:00
|
|
|
process.exit(1);
|
|
|
|
}
|
|
|
|
|
2023-10-05 03:42:57 +02:00
|
|
|
console.log('Build complete.\n');
|
2021-04-13 23:46:54 +02:00
|
|
|
});
|
|
|
|
});
|