2020-01-01 08:11:57 +00:00
|
|
|
const path = require('path');
|
2019-12-12 17:37:43 +00:00
|
|
|
const webpack = require('webpack');
|
|
|
|
|
|
|
|
module.exports = {
|
2021-08-18 15:36:32 +00:00
|
|
|
pluginOptions: {
|
|
|
|
electronBuilder: {
|
2022-03-31 07:33:58 +00:00
|
|
|
externals: ['knex', 'sqlite3'],
|
2021-11-04 09:33:51 +00:00
|
|
|
nodeIntegration: true,
|
2022-03-16 09:49:48 +00:00
|
|
|
mainProcessFile: 'main.ts',
|
2022-03-16 14:56:18 +00:00
|
|
|
// rendererProcessFile: 'src/renderer.js',
|
2022-03-16 06:42:00 +00:00
|
|
|
disableMainProcessTypescript: false,
|
|
|
|
mainProcessTypeChecking: true,
|
2021-11-04 09:33:51 +00:00
|
|
|
chainWebpackRendererProcess: (config) => {
|
|
|
|
config.target('electron-renderer');
|
2022-01-21 09:38:53 +00:00
|
|
|
config.resolve.alias.set('frappe', path.resolve(__dirname, './frappe'));
|
|
|
|
},
|
|
|
|
chainWebpackMainProcess: (config) => {
|
|
|
|
config.target('electron-main');
|
|
|
|
config.resolve.alias.set('frappe', path.resolve(__dirname, './frappe'));
|
|
|
|
config.module
|
|
|
|
.rule('js')
|
|
|
|
.test(/\.js$/)
|
|
|
|
.use('babel')
|
|
|
|
.loader('babel-loader');
|
2021-11-04 09:33:51 +00:00
|
|
|
},
|
|
|
|
},
|
2021-08-18 15:36:32 +00:00
|
|
|
},
|
2019-12-12 17:37:43 +00:00
|
|
|
pages: {
|
|
|
|
index: {
|
|
|
|
entry: 'src/main.js',
|
2021-11-04 09:33:51 +00:00
|
|
|
filename: 'index.html',
|
2019-12-12 17:37:43 +00:00
|
|
|
},
|
|
|
|
print: {
|
|
|
|
entry: 'src/print.js',
|
2021-11-04 09:33:51 +00:00
|
|
|
filename: 'print.html',
|
|
|
|
},
|
2019-12-12 17:37:43 +00:00
|
|
|
},
|
|
|
|
runtimeCompiler: true,
|
|
|
|
lintOnSave: process.env.NODE_ENV !== 'production',
|
|
|
|
configureWebpack(config) {
|
|
|
|
Object.assign(config.resolve.alias, {
|
2022-01-21 09:38:53 +00:00
|
|
|
frappe: path.resolve(__dirname, './frappe'),
|
2021-11-04 09:33:51 +00:00
|
|
|
'~': path.resolve('.'),
|
2022-03-28 10:01:29 +00:00
|
|
|
schemas: path.resolve(__dirname, './schemas'),
|
|
|
|
backend: path.resolve(__dirname, './backend'),
|
2022-03-29 08:18:39 +00:00
|
|
|
utils: path.resolve(__dirname, './utils'),
|
2022-04-11 12:44:36 +00:00
|
|
|
regional: path.resolve(__dirname, './regional'),
|
2019-12-12 17:37:43 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
config.plugins.push(
|
|
|
|
// https://github.com/knex/knex/issues/1446#issuecomment-537715431
|
|
|
|
new webpack.ContextReplacementPlugin(
|
2019-12-16 11:27:28 +00:00
|
|
|
/knex[/\\]lib[/\\]dialects/,
|
|
|
|
/sqlite3[/\\]index.js/
|
2019-12-12 17:37:43 +00:00
|
|
|
)
|
|
|
|
);
|
|
|
|
|
2020-01-28 11:10:01 +00:00
|
|
|
config.module.rules.push({
|
|
|
|
test: /\.txt$/i,
|
2021-11-04 09:33:51 +00:00
|
|
|
use: 'raw-loader',
|
2020-01-28 11:10:01 +00:00
|
|
|
});
|
|
|
|
|
2019-12-12 17:37:43 +00:00
|
|
|
config.devtool = 'source-map';
|
|
|
|
},
|
|
|
|
};
|