terminalizer/webpack.config.js

46 lines
1.1 KiB
JavaScript
Raw Normal View History

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');
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',
'window.$': 'jquery',
2018-11-04 16:14:06 +00:00
};
module.exports = {
mode: 'production',
target: 'electron-renderer',
entry: {
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'),
publicPath: '/dist/',
2018-11-04 16:14:06 +00:00
},
plugins: [
new CleanWebpackPlugin({
cleanBeforeEveryBuildPatterns: [path.join(__dirname, 'render/dist')],
}),
2018-11-04 16:14:06 +00:00
new webpack.ProvidePlugin(globals),
new MiniCssExtractPlugin({ filename: 'css/[name].css' }),
new webpack.NoEmitOnErrorsPlugin(),
2018-11-04 16:14:06 +00:00
],
module: {
rules: [
// CSS
{
test: /\.css$/,
use: [{ loader: MiniCssExtractPlugin.loader }, { loader: 'css-loader' }],
},
],
},
2018-11-04 16:14:06 +00:00
};