47 lines
1.1 KiB
JavaScript
47 lines
1.1 KiB
JavaScript
const path = require('path');
|
|
const webpack = require('webpack');
|
|
const webpackNodeExternals = require('webpack-node-externals');
|
|
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
|
|
|
|
const getEnviroment = require('./enviroment');
|
|
|
|
const rootPath = path.join(__dirname, '..');
|
|
const enviroment = getEnviroment();
|
|
|
|
module.exports = [
|
|
{
|
|
mode: process.env.ENV || 'development',
|
|
entry: path.join(rootPath, 'src', 'main'),
|
|
output: {
|
|
path: path.join(rootPath, 'dist'),
|
|
filename: 'electron-main.js'
|
|
},
|
|
target: 'electron-main',
|
|
devtool: 'source-map',
|
|
externals: [webpackNodeExternals()],
|
|
resolve: {
|
|
extensions: ['.ts', '.js']
|
|
},
|
|
module: {
|
|
rules: [
|
|
{
|
|
test: /\.ts$/,
|
|
use: [
|
|
{
|
|
loader: 'ts-loader',
|
|
options: {
|
|
configFile: path.join(rootPath, 'tsconfig.app.json')
|
|
}
|
|
}
|
|
],
|
|
exclude: /node_modules/
|
|
}
|
|
]
|
|
},
|
|
plugins: [
|
|
new CleanWebpackPlugin({ verbose: false }),
|
|
new webpack.DefinePlugin(Object.assign({}, enviroment, {}))
|
|
]
|
|
}
|
|
];
|