ucap-lg-desktop/config/webpack.config.js

47 lines
1.1 KiB
JavaScript
Raw Normal View History

2020-03-27 08:45:48 +00:00
const path = require('path');
2020-03-27 09:04:12 +00:00
const webpack = require('webpack');
2020-03-27 08:45:48 +00:00
const webpackNodeExternals = require('webpack-node-externals');
2020-03-27 09:04:12 +00:00
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
const getEnviroment = require('./enviroment');
2020-03-27 08:45:48 +00:00
const rootPath = path.join(__dirname, '..');
2020-03-27 09:04:12 +00:00
const enviroment = getEnviroment();
2020-03-27 08:45:48 +00:00
module.exports = [
{
mode: process.env.ENV || 'development',
entry: path.join(rootPath, 'src', 'main'),
2020-03-27 09:04:12 +00:00
output: {
path: path.join(rootPath, 'dist'),
filename: 'electron-main.js'
},
2020-03-27 08:45:48 +00:00
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/
}
]
},
2020-03-27 09:04:12 +00:00
plugins: [
new CleanWebpackPlugin({ verbose: false }),
new webpack.DefinePlugin(Object.assign({}, enviroment, {}))
]
2020-03-27 08:45:48 +00:00
}
];