1
0
Fork 0
VaultUI/webpack.config.js

45 lines
1.1 KiB
JavaScript
Raw Normal View History

2021-04-15 13:01:58 +01:00
const path = require('path');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
2021-05-03 15:56:21 +01:00
const VERBOSE = Object.getOwnPropertyNames(process.env).includes("VERBOSE") || !true;
const MODE = process.env.WEBPACK_MODE || "production"
const DEBUG = MODE != "production";
2021-04-15 13:01:58 +01:00
module.exports = {
2021-05-03 15:56:21 +01:00
mode: MODE,
cache: DEBUG,
2021-05-08 03:28:37 +01:00
entry: './src/main.ts',
2021-04-15 13:01:58 +01:00
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'bundle.js',
},
2021-05-03 15:56:21 +01:00
stats: {
preset: VERBOSE ? "detailed" : "normal",
colors: true,
timings: true,
},
2021-04-15 13:01:58 +01:00
plugins: [new MiniCssExtractPlugin(), new HtmlWebpackPlugin({ title: "VaultUI" })],
devServer: {
2021-04-15 13:09:03 +01:00
open: process.env.BROWSER || "microsoft-edge-dev",
2021-04-15 13:01:58 +01:00
},
resolve: {
modules: ['node_modules'],
2021-05-08 01:54:38 +01:00
extensions: ['.tsx', '.ts', '.js', ".mjs"],
2021-04-15 13:01:58 +01:00
},
2021-04-15 13:01:58 +01:00
module: {
rules: [
{
test: /\.(sa|sc|c)ss$/,
use: [
2021-04-18 11:28:55 +01:00
MiniCssExtractPlugin.loader,
"css-loader",
"sass-loader"
2021-04-15 13:01:58 +01:00
],
2021-04-18 11:28:55 +01:00
},
{ test: /\.tsx?$/, loader: "ts-loader" }
2021-04-15 13:01:58 +01:00
],
},
};