From 1fdb24b35bc18ce46a3945a1dfc1eea514057dcc Mon Sep 17 00:00:00 2001 From: Mohammad Fares Date: Sun, 4 Nov 2018 18:14:06 +0200 Subject: [PATCH] Add webpack.config.js --- webpack.config.js | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 webpack.config.js diff --git a/webpack.config.js b/webpack.config.js new file mode 100644 index 0000000..d8289f4 --- /dev/null +++ b/webpack.config.js @@ -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'} + ], + } + ] + } +};