firefox + llama.cpp == very good prose.
1import path from "path";
2import CopyPlugin from "copy-webpack-plugin";
3import HtmlMinimizerPlugin from "html-minimizer-webpack-plugin";
4import { fileURLToPath } from "url";
5
6const __dirname = path.dirname(fileURLToPath(import.meta.url));
7
8export default {
9 entry: {
10 background: "./src/background.ts",
11 result: "./src/result.ts",
12 },
13 output: {
14 filename: "[name].js",
15 path: path.resolve(__dirname, "dist"),
16 clean: true,
17 },
18 resolve: {
19 extensions: [".ts", ".js"],
20 },
21 module: {
22 rules: [
23 {
24 test: /\.ts$/,
25 use: {
26 loader: "ts-loader",
27 options: {
28 transpileOnly: true,
29 },
30 },
31 exclude: /node_modules/,
32 },
33 ],
34 },
35 plugins: [
36 new CopyPlugin({
37 patterns: [
38 { from: "src/manifest.json", to: "manifest.json" },
39 {
40 from: "src/result.html",
41 to: "result.html",
42 /** Mark as minimizable so HtmlMinimizerPlugin picks it up. */
43 info: { minimized: false },
44 },
45 { from: "assets/shakespeare-icon.png", to: "icons/shakespeare-icon.png" },
46 ],
47 }),
48 ],
49 optimization: {
50 minimize: true,
51 minimizer: [
52 "...",
53 new HtmlMinimizerPlugin({
54 minimizerOptions: {
55 collapseWhitespace: true,
56 removeComments: true,
57 minifyCSS: true,
58 removeRedundantAttributes: true,
59 removeEmptyAttributes: true,
60 removeOptionalTags: true,
61 },
62 }),
63 ],
64 },
65 performance: {
66 hints: false,
67 },
68};