mirror of
https://github.com/Telecominfraproject/wlan-cloud-ucentralgw-ui.git
synced 2025-10-30 10:22:24 +00:00
80 lines
2.0 KiB
JavaScript
80 lines
2.0 KiB
JavaScript
/* eslint-disable import/no-extraneous-dependencies */
|
|
/* eslint-disable prefer-template */
|
|
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
|
|
const CopyWebpackPlugin = require('copy-webpack-plugin');
|
|
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
|
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
|
|
const webpack = require('webpack');
|
|
const path = require('path');
|
|
const paths = require('./paths');
|
|
|
|
module.exports = {
|
|
entry: [paths.src + '/index.js'],
|
|
output: {
|
|
path: paths.build,
|
|
filename: '[name].bundle.js',
|
|
publicPath: '/',
|
|
},
|
|
resolve: {
|
|
modules: [path.resolve('./node_modules'), path.resolve('./src')],
|
|
preferRelative: true,
|
|
},
|
|
plugins: [
|
|
new webpack.DefinePlugin({
|
|
'process.env.VERSION': JSON.stringify(process.env.npm_package_version),
|
|
}),
|
|
new MiniCssExtractPlugin({
|
|
filename: 'styles/[name].[contenthash].css',
|
|
chunkFilename: '[id].[contenthash].css',
|
|
}),
|
|
new CopyWebpackPlugin({
|
|
patterns: [
|
|
{
|
|
from: paths.src + '/assets',
|
|
to: 'assets',
|
|
globOptions: {
|
|
ignore: ['*.DS_Store'],
|
|
},
|
|
},
|
|
{
|
|
from: paths.public + '/locales',
|
|
to: 'locales',
|
|
globOptions: {
|
|
ignore: ['*.DS_Store'],
|
|
},
|
|
},
|
|
{
|
|
from: paths.public + '/config.json',
|
|
to: 'config.json',
|
|
},
|
|
],
|
|
}),
|
|
new HtmlWebpackPlugin({
|
|
title: 'uCentralGW',
|
|
favicon: paths.public + '/favicon.ico',
|
|
template: paths.public + '/index.html',
|
|
filename: 'index.html',
|
|
}),
|
|
new CleanWebpackPlugin(),
|
|
],
|
|
|
|
module: {
|
|
rules: [
|
|
{
|
|
test: /\.(js|jsx)$/,
|
|
exclude: /node_modules/,
|
|
use: ['babel-loader'],
|
|
},
|
|
{
|
|
test: /\.(css|scss)$/,
|
|
use: [MiniCssExtractPlugin.loader, 'css-loader', 'sass-loader'],
|
|
},
|
|
{
|
|
test: /\.svg$/,
|
|
use: ['@svgr/webpack'],
|
|
},
|
|
{ test: /\.(?:ico|gif|png|jpg|jpeg)$/i, type: 'asset/resource' },
|
|
],
|
|
},
|
|
};
|