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-04-19 05:59:36 +00:00
|
|
|
config.resolve.alias.set('fyo', path.resolve(__dirname, './fyo'));
|
2022-04-21 13:08:36 +00:00
|
|
|
config.resolve.alias.set('utils', path.resolve(__dirname, './utils'));
|
2022-01-21 09:38:53 +00:00
|
|
|
},
|
|
|
|
chainWebpackMainProcess: (config) => {
|
|
|
|
config.target('electron-main');
|
2022-04-19 05:59:36 +00:00
|
|
|
config.resolve.alias.set('fyo', path.resolve(__dirname, './fyo'));
|
2022-04-21 13:08:36 +00:00
|
|
|
config.resolve.alias.set('utils', path.resolve(__dirname, './utils'));
|
2022-01-21 09:38:53 +00:00
|
|
|
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: {
|
2022-04-20 10:41:27 +00:00
|
|
|
entry: 'src/renderer.ts',
|
2021-11-04 09:33:51 +00:00
|
|
|
filename: 'index.html',
|
2019-12-12 17:37:43 +00:00
|
|
|
},
|
|
|
|
print: {
|
2022-04-20 10:41:27 +00:00
|
|
|
entry: 'src/print.ts',
|
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-04-19 05:59:36 +00:00
|
|
|
fyo: path.resolve(__dirname, './fyo'),
|
2022-04-20 06:38:47 +00:00
|
|
|
src: path.resolve(__dirname, './src'),
|
2022-03-28 10:01:29 +00:00
|
|
|
schemas: path.resolve(__dirname, './schemas'),
|
|
|
|
backend: path.resolve(__dirname, './backend'),
|
2022-04-21 13:08:36 +00:00
|
|
|
models: path.resolve(__dirname, './models'),
|
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'),
|
2022-04-21 13:08:36 +00:00
|
|
|
reports: path.resolve(__dirname, './reports'),
|
2022-05-10 09:26:17 +00:00
|
|
|
dummy: path.resolve(__dirname, './dummy'),
|
2022-04-20 06:38:47 +00:00
|
|
|
fixtures: path.resolve(__dirname, './fixtures'),
|
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';
|
|
|
|
},
|
|
|
|
};
|