LANCommander/LANCommander.UI/webpack.config.js
2026-01-03 15:51:21 -06:00

69 lines
No EOL
2 KiB
JavaScript

const path = require('path');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const CopyWebpackPlugin = require('copy-webpack-plugin');
module.exports = {
entry: ['./Main.ts', './_Imports.razor.scss'], // Adjust the path if your index.js is located elsewhere
module: {
rules: [
{
test: /\.tsx?$/,
use: 'ts-loader',
exclude: /nodemodules/,
},
{
test: /\.(css)$/,
use: [
MiniCssExtractPlugin.loader,
{
loader: 'css-loader',
options: { sourceMap: true }
}
],
},
{
test: /\.s[ac]ss$/i,
use: [
MiniCssExtractPlugin.loader,
{
loader: 'css-loader',
options: { sourceMap: true }
},
{
loader: 'sass-loader',
options: { sourceMap: true }
}
],
}
],
},
resolve: {
extensions: ['.tsx', '.ts', '.js'],
},
output: {
filename: 'bundle.js', // The output file
path: path.resolve(__dirname, 'wwwroot'), // The output directory
module: true,
library: {
type: 'module',
}
},
experiments: {
outputModule: true,
},
plugins: [
new MiniCssExtractPlugin({
filename: "ui.css"
}),
new CopyWebpackPlugin({
patterns: [
{
from: path.resolve(__dirname, 'node_modules/bootstrap-icons/bootstrap-icons.svg'),
to: path.resolve(__dirname, 'wwwroot')
}
]
}),
],
mode: 'production', // Use 'production' for minified output
devtool: 'source-map'
};