2018-11-04 16:14:06 +00:00
|
|
|
const webpack = require('webpack');
|
|
|
|
const path = require('path');
|
|
|
|
|
|
|
|
// Extract CSS into separate files
|
|
|
|
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
|
2022-09-05 18:54:57 +00:00
|
|
|
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
|
2018-11-04 16:14:06 +00:00
|
|
|
|
|
|
|
// Global variables
|
|
|
|
const globals = {
|
|
|
|
$: 'jquery',
|
|
|
|
jQuery: 'jquery',
|
|
|
|
Terminal: ['xterm', 'Terminal'],
|
|
|
|
'window.jQuery': 'jquery',
|
2022-09-05 18:54:57 +00:00
|
|
|
'window.$': 'jquery',
|
2018-11-04 16:14:06 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
module.exports = {
|
|
|
|
mode: 'production',
|
|
|
|
target: 'electron-renderer',
|
|
|
|
entry: {
|
2022-09-05 18:54:57 +00:00
|
|
|
app: './render/src/js/app.js',
|
2018-11-04 16:14:06 +00:00
|
|
|
},
|
|
|
|
output: {
|
|
|
|
filename: 'js/[name].js',
|
|
|
|
path: path.resolve(__dirname, 'render/dist'),
|
2022-09-05 18:54:57 +00:00
|
|
|
publicPath: '/dist/',
|
2018-11-04 16:14:06 +00:00
|
|
|
},
|
|
|
|
plugins: [
|
2022-09-05 18:54:57 +00:00
|
|
|
new CleanWebpackPlugin({
|
|
|
|
cleanBeforeEveryBuildPatterns: [path.join(__dirname, 'render/dist')],
|
|
|
|
}),
|
2018-11-04 16:14:06 +00:00
|
|
|
new webpack.ProvidePlugin(globals),
|
2022-09-05 18:54:57 +00:00
|
|
|
new MiniCssExtractPlugin({ filename: 'css/[name].css' }),
|
|
|
|
new webpack.NoEmitOnErrorsPlugin(),
|
2018-11-04 16:14:06 +00:00
|
|
|
],
|
|
|
|
module: {
|
|
|
|
rules: [
|
|
|
|
// CSS
|
|
|
|
{
|
|
|
|
test: /\.css$/,
|
2022-09-05 18:54:57 +00:00
|
|
|
use: [{ loader: MiniCssExtractPlugin.loader }, { loader: 'css-loader' }],
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
2018-11-04 16:14:06 +00:00
|
|
|
};
|