Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions frontend/react/config/webpack.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
const path = require('path')
const TerserPlugin = require('terser-webpack-plugin')

console.log('initializing webpack ....')
module.exports = {
entry: {
bundle: path.resolve( "./src/index.js"),
},
output: {
filename: '[name].js',
path: path.resolve(__dirname,'../dist/'),
// publicPath: __dirname+'./dist/' // already automamted in webpack 5
assetModuleFilename: 'assets/[name][ext]', // to customize output of asset/resource see link for reference https://webpack.js.org/guides/asset-modules/,


},
module: {
rules: [
{
test: /\.(png|jpg|jpeg|gif|svg)$/i, // i to be case insensitive
type: 'asset',// General asset type let webpack decide either asset/resource or asset/inline default rule ifFile > 8kb asset/resource ifFile < 8kb asset/inline
parser: {
dataUrlCondition: { // Set size configuration on what will webpack select either asset/resource or asset/inline
maxSize: 10 * 1024 // 10 kilobytes if lesser inline else resource
}
}
},
{
test: /\.txt/,
type: 'asset/source'
},
]
}

}
12 changes: 12 additions & 0 deletions frontend/react/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>React App</title>
</head>
<body>
<script defer src="./dist/bundle.js"></script>
</body>
</html>
Loading