Add webpack.config.js

This commit is contained in:
Mohammad Fares 2018-11-04 18:14:06 +02:00
parent 0d9adf4bbf
commit 1fdb24b35b
1 changed files with 46 additions and 0 deletions

46
webpack.config.js Normal file
View File

@ -0,0 +1,46 @@
const webpack = require('webpack');
const path = require('path');
// Extract CSS into separate files
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const CleanWebpackPlugin = require('clean-webpack-plugin');
// Global variables
const globals = {
$: 'jquery',
jQuery: 'jquery',
Terminal: ['xterm', 'Terminal'],
'window.jQuery': 'jquery',
'window.$': 'jquery'
};
module.exports = {
mode: 'production',
target: 'electron-renderer',
entry: {
app: './render/src/js/app.js'
},
output: {
filename: 'js/[name].js',
path: path.resolve(__dirname, 'render/dist'),
publicPath: '/dist/'
},
plugins: [
new CleanWebpackPlugin(['./render/dist'], {verbose: false}),
new webpack.ProvidePlugin(globals),
new MiniCssExtractPlugin({filename: 'css/[name].css'}),
new webpack.NoEmitOnErrorsPlugin()
],
module: {
rules: [
// CSS
{
test: /\.css$/,
use: [
{loader: MiniCssExtractPlugin.loader},
{loader: 'css-loader'}
],
}
]
}
};