Simplify webpack configuration

This commit is contained in:
Jonatan Kłosko 2022-11-12 02:16:02 +01:00
parent 3504bac3f6
commit dc5be4a241
9 changed files with 31 additions and 814 deletions

796
assets/package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -12,7 +12,6 @@
"@fontsource/inter": "^4.2.2", "@fontsource/inter": "^4.2.2",
"@fontsource/jetbrains-mono": "^4.2.2", "@fontsource/jetbrains-mono": "^4.2.2",
"@fontsource/red-hat-text": "^4.2.2", "@fontsource/red-hat-text": "^4.2.2",
"assert": "^2.0.0",
"crypto-js": "^4.0.0", "crypto-js": "^4.0.0",
"css-minimizer-webpack-plugin": "^4.0.0", "css-minimizer-webpack-plugin": "^4.0.0",
"hast-util-to-text": "^3.1.1", "hast-util-to-text": "^3.1.1",
@ -27,7 +26,6 @@
"phoenix_live_view": "file:../deps/phoenix_live_view", "phoenix_live_view": "file:../deps/phoenix_live_view",
"postcss-import": "^15.0.0", "postcss-import": "^15.0.0",
"postcss-loader": "^7.0.1", "postcss-loader": "^7.0.1",
"process": "^0.11.10",
"rehype-katex": "^6.0.0", "rehype-katex": "^6.0.0",
"rehype-parse": "^8.0.3", "rehype-parse": "^8.0.3",
"rehype-raw": "^6.0.0", "rehype-raw": "^6.0.0",

View file

@ -1,6 +1,5 @@
const path = require("path"); const path = require("path");
const glob = require("glob"); const glob = require("glob");
const webpack = require("webpack");
const MiniCssExtractPlugin = require("mini-css-extract-plugin"); const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const CssMinimizerPlugin = require("css-minimizer-webpack-plugin"); const CssMinimizerPlugin = require("css-minimizer-webpack-plugin");
const MonacoWebpackPlugin = require("monaco-editor-webpack-plugin"); const MonacoWebpackPlugin = require("monaco-editor-webpack-plugin");
@ -49,36 +48,22 @@ module.exports = (env, options) => {
], ],
}, },
plugins: [ plugins: [
// Polyfill the global "process" variable required by "remark" internals
new webpack.ProvidePlugin({
process: "process/browser.js",
}),
new MiniCssExtractPlugin({ filename: "../css/app.css" }), new MiniCssExtractPlugin({ filename: "../css/app.css" }),
new MonacoWebpackPlugin({ new MonacoWebpackPlugin({
languages: ["markdown", "elixir", "xml", "json", "sql", "html", "css", "javascript"], languages: [
"markdown",
"elixir",
"xml",
"json",
"sql",
"html",
"css",
"javascript",
],
}), }),
], ],
optimization: { optimization: {
minimizer: ["...", new CssMinimizerPlugin()], minimizer: ["...", new CssMinimizerPlugin()],
splitChunks: {
cacheGroups: {
// Chunk splitting is by default enabled for all async chunks,
// so for the dynamically loaded js/vega_lite/vega.js Webpack
// would produce one almost empty chunk and then a vendor chunk
// with "vega" and "vega-embed". We want to dynamically load all
// of it at once, so we disable the default vendors chunk
defaultVendors: false
}
}
},
resolve: {
fallback: {
// The crypto-js package relies no the crypto module, but it has
// fine support in browsers, so we don't provide polyfills
crypto: false,
// Polyfill the assert module required by "remark" internals
assert: require.resolve("assert"),
},
}, },
}; };
}; };

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long