chore: remove webpack

This commit is contained in:
Kieran 2023-11-20 21:33:11 +00:00
parent c44877f780
commit 7b4e6db306
Signed by: Kieran
GPG Key ID: DE71CEB3925BE941
3 changed files with 94 additions and 6061 deletions

View File

@ -15,7 +15,6 @@
"@snort/system-wasm": "workspace:*",
"@snort/system-web": "workspace:*",
"@szhsin/react-menu": "^3.3.1",
"@types/use-sync-external-store": "^0.0.4",
"@uidotdev/usehooks": "^2.3.1",
"@void-cat/api": "^1.0.10",
"classnames": "^2.3.2",
@ -76,13 +75,7 @@
]
},
"devDependencies": {
"@babel/core": "^7.22.9",
"@babel/plugin-syntax-import-assertions": "^7.20.0",
"@babel/preset-env": "^7.21.5",
"@babel/preset-react": "^7.18.6",
"@babel/runtime": "^7.22.6",
"@formatjs/cli": "^6.1.3",
"@formatjs/ts-transformer": "^3.13.3",
"@jest/globals": "^29.6.1",
"@types/config": "^3.3.3",
"@types/debug": "^4.1.8",
@ -91,6 +84,7 @@
"@types/react": "^18.0.26",
"@types/react-dom": "^18.0.10",
"@types/three": "^0.157.2",
"@types/use-sync-external-store": "^0.0.4",
"@types/uuid": "^9.0.2",
"@types/webscopeio__react-textarea-autocomplete": "^4.7.2",
"@types/webtorrent": "^0.109.3",
@ -98,40 +92,24 @@
"@typescript-eslint/parser": "^6.1.0",
"@vitejs/plugin-react": "^4.2.0",
"@webbtc/webln-types": "^1.0.10",
"@webpack-cli/generators": "^3.0.4",
"@webscopeio/react-textarea-autocomplete": "^4.9.2",
"autoprefixer": "^10.4.16",
"babel-loader": "^9.1.3",
"config": "^3.3.9",
"copy-webpack-plugin": "^11.0.0",
"css-loader": "^6.7.3",
"css-minimizer-webpack-plugin": "^5.0.0",
"eslint": "^8.48.0",
"eslint-plugin-formatjs": "^4.11.3",
"eslint-webpack-plugin": "^4.0.1",
"html-webpack-plugin": "^5.5.1",
"jest": "^29.5.0",
"jest-environment-jsdom": "^29.5.0",
"mini-css-extract-plugin": "^2.7.5",
"postcss": "^8.4.31",
"postcss-loader": "^7.3.3",
"postcss-preset-env": "^9.2.0",
"prettier": "2.8.3",
"prop-types": "^15.8.1",
"rollup-plugin-visualizer": "^5.9.2",
"source-map-loader": "^4.0.1",
"tailwindcss": "^3.3.3",
"terser-webpack-plugin": "^5.3.9",
"tinybench": "^2.5.1",
"ts-jest": "^29.1.1",
"ts-loader": "^9.4.4",
"typescript": "^5.2.2",
"vite": "^5.0.0",
"vite-plugin-pwa": "^0.17.0",
"webpack": "^5.88.2",
"webpack-bundle-analyzer": "^4.8.0",
"webpack-cli": "^5.1.4",
"webpack-dev-server": "^4.15.1",
"workbox-webpack-plugin": "^6.5.4"
"vite-plugin-version-mark": "^0.0.10"
}
}

View File

@ -1,199 +0,0 @@
// Generated using webpack-cli https://github.com/webpack/webpack-cli
const path = require("path");
const HtmlWebpackPlugin = require("html-webpack-plugin");
const TerserPlugin = require("terser-webpack-plugin");
const ESLintPlugin = require("eslint-webpack-plugin");
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const CssMinimizerPlugin = require("css-minimizer-webpack-plugin");
const CopyPlugin = require("copy-webpack-plugin");
const WorkboxPlugin = require("workbox-webpack-plugin");
const IntlTsTransformer = require("@formatjs/ts-transformer");
const { DefinePlugin } = require("webpack");
const appConfig = require("config");
const isProduction = process.env.NODE_ENV == "production";
const appTitle = appConfig.get("appTitle");
const gitVersion = require("child_process").execSync("git describe --always --tags").toString().trim();
const copyPatterns = [
{ from: "public/robots.txt" },
{ from: "public/nostrich_512.png" },
{ from: "public/nostrich_256.png" },
{ from: "_headers" },
];
if (appTitle === "iris") {
copyPatterns.push({ from: "public/iris/manifest_iris.json", to: "manifest.json" });
copyPatterns.push({ from: "public/iris/img", to: "img" });
copyPatterns.push({ from: "public/iris/.well-known", to: ".well-known" });
} else {
copyPatterns.push({ from: "public/manifest.json" });
copyPatterns.push({ from: "public/snort/.well-known", to: ".well-known" });
}
const config = {
entry: {
main: "./src/index.tsx",
pow: {
import: require.resolve("@snort/system/dist/pow-worker.js"),
filename: "pow.js",
},
bench: "./src/benchmarks.ts",
},
target: "browserslist",
mode: isProduction ? "production" : "development",
devtool: isProduction ? "source-map" : "cheap-module-source-map",
output: {
publicPath: "/",
path: path.resolve(__dirname, "build"),
filename: isProduction ? "[name].[chunkhash].js" : "[name].js",
clean: isProduction,
},
devServer: {
open: true,
https: true,
host: "localhost",
historyApiFallback: true,
},
plugins: [
new CopyPlugin({
patterns: copyPatterns,
}),
new HtmlWebpackPlugin({
template: "public/index.html",
favicon: appConfig.get("favicon"),
excludeChunks: ["pow", "bench"],
templateParameters: {
appTitle,
appleTouchIconUrl: appConfig.get("appleTouchIconUrl"),
},
}),
new HtmlWebpackPlugin({
filename: "bench.html",
template: "public/bench.html",
chunks: ["bench"],
}),
new ESLintPlugin({
extensions: ["js", "mjs", "jsx", "ts", "tsx"],
eslintPath: require.resolve("eslint"),
failOnError: true,
cache: true,
}),
new MiniCssExtractPlugin({
filename: isProduction ? "[name].[chunkhash].css" : "[name].css",
}),
isProduction
? new WorkboxPlugin.InjectManifest({
swSrc: "./src/service-worker.ts",
})
: false,
new DefinePlugin({
CONFIG: JSON.stringify(appConfig),
SINGLE_RELAY: JSON.stringify(process.env.SINGLE_RELAY),
GIT_VERSION: JSON.stringify(gitVersion),
}),
],
module: {
rules: [
{
enforce: "pre",
exclude: /@babel(?:\/|\\{1,2})runtime/,
test: /\.(js|mjs|jsx|ts|tsx|css)$/,
loader: require.resolve("source-map-loader"),
options: {
filterSourceMappingUrl: (url, resourcePath) => {
// disable warning for missing @scure-bip39 sourcemaps
if (/.*\/.yarn\/cache\/@scure-bip39.*/.test(resourcePath)) {
return false;
}
return true;
},
},
},
{
test: /\.tsx?$/i,
exclude: ["/node_modules/"],
use: [
{
loader: require.resolve("babel-loader"),
options: {
babelrc: false,
configFile: false,
presets: [["@babel/preset-env"], ["@babel/preset-react", { runtime: "automatic" }]],
},
},
{
loader: require.resolve("ts-loader"),
options: {
getCustomTransformers() {
return {
before: [
IntlTsTransformer.transform({
overrideIdFn: "[sha512:contenthash:base64:6]",
ast: true,
}),
],
};
},
},
},
],
},
{
test: /\.css$/i,
use: [
MiniCssExtractPlugin.loader,
require.resolve("css-loader"),
{
loader: require.resolve("postcss-loader"),
options: {
postcssOptions: {
plugins: [require("tailwindcss"), require("autoprefixer")],
},
},
},
],
},
{
test: /\.(eot|svg|ttf|woff|woff2|png|jpg|gif|webp|wasm|md)$/i,
type: "asset",
},
],
},
optimization: {
chunkIds: "deterministic",
minimize: isProduction,
minimizer: [
new TerserPlugin({
terserOptions: {
parse: {
ecma: 8,
},
compress: {
ecma: 5,
warnings: false,
comparisons: false,
inline: 2,
},
mangle: {
safari10: true,
},
keep_classnames: isProduction,
keep_fnames: isProduction,
},
}),
new CssMinimizerPlugin(),
],
},
resolve: {
aliasFields: ["browser"],
extensions: ["...", ".tsx", ".ts", ".jsx", ".js"],
modules: ["...", __dirname, path.resolve(__dirname, "src")],
fallback: { crypto: false },
},
};
module.exports = () => config;

5930
yarn.lock

File diff suppressed because it is too large Load Diff