-
Notifications
You must be signed in to change notification settings - Fork 5
/
webpack.common.js
61 lines (59 loc) · 1.64 KB
/
webpack.common.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const REPO_URL = 'https://github.com/calebj0seph/password-generator';
const BASE_URL = 'https://calebj0seph.github.io/password-generator';
module.exports = {
entry: ['focus-visible', './src/index.jsx'],
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'main.js',
},
resolve: {
alias: {
static: path.resolve(__dirname, 'static/'),
components: path.resolve(__dirname, 'src/components/'),
util: path.resolve(__dirname, 'src/util/'),
style: path.resolve(__dirname, 'src/style/'),
},
extensions: ['.wasm', '.mjs', '.js', '.jsx', '.json'],
},
module: {
rules: [
{
test: /\.(js|jsx)$/,
exclude: /(node_modules|bower_components)/,
use: {
loader: 'babel-loader',
options: {
presets: ['@babel/env', '@babel/react'],
},
},
},
{
test: /\.svg$/,
use: ['@svgr/webpack'],
},
],
},
plugins: [
new HtmlWebpackPlugin({
template: 'src/index.html',
templateParameters: {
title: 'Password Generator',
description: 'A highly configurable tool for generating cryptographically secure random passwords inside your browser.',
repoUrl: REPO_URL,
canonicalUrl: BASE_URL,
openGraphImageUrl: `${BASE_URL}/static/og.jpg`,
},
minify: {
collapseWhitespace: true,
},
}),
new CopyWebpackPlugin({
patterns: [
{ from: 'static/*.jpg', to: './' },
],
}),
],
};