Add webpack config for prod

This commit is contained in:
Mark Sinclair
2021-11-10 08:44:36 +00:00
parent 1a1a2a0355
commit d7090ecb5a
3 changed files with 1048 additions and 27 deletions
+2 -1
View File
@@ -5,7 +5,7 @@
"license": "MIT",
"scripts": {
"webpack:dev": "yarn webpack serve",
"webpack:build": "yarn webpack",
"webpack:build": "yarn webpack --progress --config webpack.prod.config.js",
"tauri:dev": "yarn tauri dev",
"tauri:build": "yarn tauri build",
"dev": "yarn run webpack:dev & yarn run tauri:dev",
@@ -43,6 +43,7 @@
"@types/semver": "^7.3.8",
"babel-loader": "^8.2.2",
"css-loader": "^6.2.0",
"favicons": "^6.2.2",
"favicons-webpack-plugin": "^5.0.2",
"file-loader": "^6.2.0",
"html-webpack-plugin": "^5.3.2",
+42
View File
@@ -0,0 +1,42 @@
const HtmlWebpackPlugin = require('html-webpack-plugin')
const FaviconsWebpackPlugin = require('favicons-webpack-plugin')
var path = require('path')
module.exports = {
mode: 'production',
node: {
__dirname: false
},
entry: path.resolve(__dirname, './src/index'),
plugins: [
new HtmlWebpackPlugin({
template: path.resolve(__dirname, './public/index.html'),
filename: 'index.html',
}),
new FaviconsWebpackPlugin(path.resolve(__dirname, './src/images/logo.png')),
],
module: {
rules: [
{
test: /\.(ts|tsx)$/,
exclude: /node_modules/,
use: ['babel-loader'],
},
{
test: /\.css$/i,
use: ['style-loader', 'css-loader'],
},
{
test: /\.(png|jpe?g|gif|svg)$/i,
use: [
{
loader: 'file-loader',
},
],
},
],
},
resolve: {
extensions: ['*', '.js', '.jsx', '.ts', '.tsx'],
},
}
+1004 -26
View File
File diff suppressed because it is too large Load Diff