mirror of
https://gitlab.com/psono/psono-admin-client
synced 2025-04-19 03:22:17 +03:00
84 lines
2.1 KiB
JavaScript
84 lines
2.1 KiB
JavaScript
const path = require('path');
|
|
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
|
const CopyWebpackPlugin = require('copy-webpack-plugin');
|
|
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
|
|
const webpack = require('webpack');
|
|
const paths = {
|
|
publicUrlOrPath: '/portal/',
|
|
};
|
|
|
|
module.exports = {
|
|
entry: './src/index.js',
|
|
output: {
|
|
filename: 'static/js/[name].[contenthash:8].js',
|
|
chunkFilename: 'static/js/[name].[contenthash:8].chunk.js',
|
|
path: path.resolve(__dirname, 'build'),
|
|
publicPath: '/portal/',
|
|
},
|
|
plugins: [
|
|
new CleanWebpackPlugin(),
|
|
new CopyWebpackPlugin({
|
|
patterns: [
|
|
{
|
|
from: 'public',
|
|
to: '',
|
|
globOptions: {
|
|
ignore: ['**/index.html'],
|
|
},
|
|
},
|
|
],
|
|
}),
|
|
new webpack.ProvidePlugin({
|
|
process: 'process/browser',
|
|
Buffer: ['buffer', 'Buffer'],
|
|
}),
|
|
],
|
|
module: {
|
|
rules: [
|
|
{
|
|
test: /\.(js|jsx)$/,
|
|
exclude: /node_modules/,
|
|
use: {
|
|
loader: 'babel-loader',
|
|
options: {
|
|
presets: [
|
|
['@babel/preset-env', { targets: { node: 'current' } }],
|
|
'@babel/preset-react',
|
|
],
|
|
plugins: [
|
|
'@babel/plugin-proposal-class-properties',
|
|
'@babel/plugin-transform-runtime',
|
|
],
|
|
},
|
|
},
|
|
},
|
|
{
|
|
test: /\.css$/,
|
|
use: ['style-loader', 'css-loader'],
|
|
},
|
|
{
|
|
test: /\.(png|svg|jpg|jpeg|gif|ico)$/i,
|
|
type: 'asset/resource',
|
|
generator: {
|
|
filename: 'static/media/[name].[hash:8][ext]',
|
|
},
|
|
},
|
|
{
|
|
test: /\.(woff|woff2|eot|ttf|otf)$/i,
|
|
type: 'asset/resource',
|
|
generator: {
|
|
filename: 'static/media/[name].[hash:8][ext]',
|
|
},
|
|
},
|
|
],
|
|
},
|
|
resolve: {
|
|
extensions: ['.js', '.jsx'],
|
|
fallback: {
|
|
"crypto": false,
|
|
"buffer": require.resolve("buffer/"),
|
|
"path": require.resolve("path-browserify"),
|
|
"process": require.resolve("process/browser"),
|
|
},
|
|
},
|
|
}; |