summaryrefslogtreecommitdiff
path: root/webpack.config.js
diff options
context:
space:
mode:
Diffstat (limited to 'webpack.config.js')
-rw-r--r--webpack.config.js87
1 files changed, 87 insertions, 0 deletions
diff --git a/webpack.config.js b/webpack.config.js
new file mode 100644
index 0000000..a24703d
--- /dev/null
+++ b/webpack.config.js
@@ -0,0 +1,87 @@
+const path = require('path');
+const webpack = require('webpack');
+const MiniCssExtractPlugin = require('mini-css-extract-plugin');
+const { VueLoaderPlugin } = require('vue-loader');
+
+const isProduction = process.env.NODE_ENV === 'production';
+
+// main config
+const config = {
+ mode: isProduction ? 'production' : 'development',
+ devtool: isProduction ? false : 'source-map',
+
+ entry: {
+ index: './app/src/index.js',
+ },
+
+ output: {
+ path: path.resolve(__dirname, 'app/build'),
+ filename: '[name].js',
+ },
+
+ resolve: {
+ extensions: ['.js', '.vue'],
+
+ alias: {
+ '~': path.join(__dirname, 'app/src'),
+ },
+ },
+
+ module: {
+ rules: [
+ {
+ test: /\.vue$/,
+ loader: 'vue-loader',
+ },
+ {
+ test: /\.js$/,
+ loader: 'babel-loader',
+ options: {
+ presets: [
+ ['@babel/preset-env', {
+ targets: {
+ browsers: ['> 1%', 'last 2 versions'],
+ },
+ }],
+ ],
+ plugins: [
+ '@babel/plugin-transform-runtime',
+ ],
+ },
+ exclude: path.resolve(__dirname, 'node_modules'),
+ },
+ {
+ test: /\.s?css$/,
+ use: [
+ { loader: MiniCssExtractPlugin.loader },
+ { loader: 'css-loader' },
+ { loader: 'sass-loader' },
+ ],
+ },
+ {
+ test: /\.(jpg|png)$/,
+ loader: 'url-loader',
+ options: {
+ limit: 8192,
+ outputPath: 'assets/img',
+ esModule: false,
+ },
+ },
+ ],
+ },
+
+ plugins: [
+ new webpack.DefinePlugin({
+ __VUE_OPTIONS_API__: true,
+ __VUE_PROD_DEVTOOLS__: false,
+ electron: require('electron'),
+ }),
+ new webpack.ExternalsPlugin('commonjs', ['electron']),
+ new MiniCssExtractPlugin(),
+ new VueLoaderPlugin(),
+ ],
+
+ target: 'electron-renderer',
+};
+
+module.exports = config;