-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.js
43 lines (38 loc) · 999 Bytes
/
build.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
'use strict';
const { execSync } = require('child_process');
const webpack = require('webpack');
execSync('npm run tailwind');
console.log('Compiled css');
const config = {
mode: 'development',
// You need to list out every file you want to bundle in `entry`
entry: {
main: `${__dirname}/main.js`
},
output: {
path: `${__dirname}/public`,
filename: '[name].js'
},
optimization: {
minimize: false
},
target: 'web',
resolve: {
fallback: {
assert: require.resolve('assert-browserify'),
buffer: require.resolve('buffer'),
crypto: require.resolve('crypto-browserify'),
stream: require.resolve('stream-browserify'),
path: require.resolve('path-browserify')
}
}
};
const compiler = webpack(config);
compiler.run((err, res) => {
if (err) {
process.nextTick(() => { throw new Error('Error compiling bundle: ' + err.stack); });
}
console.log(res);
console.log('Webpack compiled successfully');
process.exit(0);
});