Bundle sql worker with webpack
This commit is contained in:
parent
31a777a130
commit
1ca121aef5
9 changed files with 177 additions and 110 deletions
|
@ -5,7 +5,6 @@ import { resolve } from 'path';
|
|||
// eslint-disable-next-line import/no-extraneous-dependencies
|
||||
import { Configuration, EnvironmentPlugin, ProvidePlugin } from 'webpack';
|
||||
import HtmlWebpackPlugin = require('html-webpack-plugin');
|
||||
import TerserPlugin = require('terser-webpack-plugin');
|
||||
|
||||
const context = __dirname;
|
||||
const { NODE_ENV: mode = 'development' } = process.env;
|
||||
|
@ -90,63 +89,4 @@ const stickerCreatorConfig: Configuration = {
|
|||
},
|
||||
};
|
||||
|
||||
const EXTERNAL_MODULE = new Set([
|
||||
'backbone',
|
||||
'better-sqlite3',
|
||||
'ffi-napi',
|
||||
'fs-xattr',
|
||||
'fsevents',
|
||||
'got',
|
||||
'jquery',
|
||||
'libsignal-client',
|
||||
'node-fetch',
|
||||
'node-sass',
|
||||
'pino',
|
||||
'proxy-agent',
|
||||
'ref-array-napi',
|
||||
'ref-napi',
|
||||
'ringrtc',
|
||||
'sharp',
|
||||
'websocket',
|
||||
'zkgroup',
|
||||
]);
|
||||
|
||||
const preloadConfig: Configuration = {
|
||||
context,
|
||||
mode: mode as Configuration['mode'],
|
||||
devtool: mode === 'development' ? 'inline-source-map' : false,
|
||||
entry: ['./preload.js'],
|
||||
// Stack-traces have to be readable so don't mangle function names.
|
||||
optimization: {
|
||||
minimizer: [
|
||||
new TerserPlugin({
|
||||
terserOptions: {
|
||||
mangle: {
|
||||
keep_fnames: true,
|
||||
},
|
||||
},
|
||||
}),
|
||||
],
|
||||
},
|
||||
target: 'electron-preload',
|
||||
output: {
|
||||
path: resolve(context),
|
||||
filename: 'preload.bundle.js',
|
||||
publicPath: './',
|
||||
},
|
||||
resolve: {
|
||||
extensions: ['.js'],
|
||||
alias: {},
|
||||
},
|
||||
externals: [
|
||||
({ request = '' }, callback) => {
|
||||
if (EXTERNAL_MODULE.has(request)) {
|
||||
return callback(undefined, `commonjs2 ${request}`);
|
||||
}
|
||||
|
||||
callback();
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
export default [stickerCreatorConfig, preloadConfig];
|
||||
export default [stickerCreatorConfig];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue