2021-05-18 11:10:47 +01:00
|
|
|
const path = require('path');
|
|
|
|
const webpack = require('webpack');
|
|
|
|
var os = require("os");
|
|
|
|
|
|
|
|
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
|
|
|
const { GitRevisionPlugin } = require('git-revision-webpack-plugin');
|
|
|
|
const gitRevisionPlugin = new GitRevisionPlugin();
|
|
|
|
let commitHash = gitRevisionPlugin.commithash();
|
|
|
|
|
|
|
|
module.exports = {
|
|
|
|
mode: "development",
|
|
|
|
cache: true,
|
2021-05-24 09:48:13 +01:00
|
|
|
entry: './src/main.tsx',
|
2021-05-18 11:10:47 +01:00
|
|
|
output: {
|
|
|
|
path: path.resolve(__dirname, 'dist'),
|
|
|
|
filename: 'bundle.js',
|
2022-01-06 18:53:38 +00:00
|
|
|
publicPath: '/',
|
2021-05-18 11:10:47 +01:00
|
|
|
},
|
|
|
|
stats: {
|
|
|
|
colors: true,
|
|
|
|
timings: true,
|
|
|
|
},
|
|
|
|
plugins: [
|
|
|
|
new HtmlWebpackPlugin({ title: "VaultUI" }),
|
|
|
|
new webpack.DefinePlugin({
|
|
|
|
BUILD_STRING:
|
|
|
|
JSON.stringify(`Built At: ${new Date().toString()} by ${os.userInfo().username}@${os.hostname()} on commit ${commitHash}`),
|
|
|
|
})
|
|
|
|
],
|
|
|
|
devServer: {
|
2021-11-21 10:51:12 +00:00
|
|
|
open: process.env.BROWSER,
|
2022-01-06 18:53:38 +00:00
|
|
|
historyApiFallback: true,
|
2021-05-18 11:10:47 +01:00
|
|
|
},
|
|
|
|
resolve: {
|
|
|
|
modules: ['node_modules'],
|
|
|
|
extensions: ['.tsx', '.ts', '.js', ".mjs"],
|
2022-01-13 18:09:03 +00:00
|
|
|
alias: {os: false}
|
2021-05-18 11:10:47 +01:00
|
|
|
},
|
|
|
|
|
|
|
|
module: {
|
|
|
|
rules: [
|
2022-01-11 10:57:30 +00:00
|
|
|
{
|
|
|
|
assert: { type: "css" },
|
|
|
|
loader: "css-loader",
|
|
|
|
options: {
|
|
|
|
exportType: "string",
|
|
|
|
},
|
|
|
|
},
|
2021-05-18 11:10:47 +01:00
|
|
|
{
|
|
|
|
test: /\.(sa|sc|c)ss$/,
|
|
|
|
use: [
|
|
|
|
"sass-loader"
|
|
|
|
],
|
|
|
|
},
|
|
|
|
{
|
|
|
|
test: /\.ts(x?)$/,
|
|
|
|
use: [
|
|
|
|
{
|
|
|
|
loader: 'ts-loader'
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
};
|