summaryrefslogtreecommitdiffstats
path: root/webpack.config.js
diff options
context:
space:
mode:
authorsilverwind <me@silverwind.io>2020-01-28 22:57:20 +0100
committerLauris BH <lauris@nix.lv>2020-01-28 23:57:20 +0200
commitb9690d7c0b4980c46b3416e36478fa0140dd5f9e (patch)
tree9395508c79655a7807f98de4d0a4fd75267f6a76 /webpack.config.js
parentd879353632c5220c8ac0e3831311ebfe7cf357fe (diff)
downloadgitea-b9690d7c0b4980c46b3416e36478fa0140dd5f9e.tar.gz
gitea-b9690d7c0b4980c46b3416e36478fa0140dd5f9e.zip
move highlight.js to npm/webpack (#10011)
- introduced window.config to help with js-based lazy-loading - adjusted webpack chunk naming to avoid 'vendors~name.js' that webpack defaults to for vendor chunks. - added theme class to html and prefixed all selectors. this is neccesary so that the theme styles win over the lazy-loaded ones. Co-authored-by: zeripath <art27@cantab.net>
Diffstat (limited to 'webpack.config.js')
-rw-r--r--webpack.config.js14
1 files changed, 9 insertions, 5 deletions
diff --git a/webpack.config.js b/webpack.config.js
index 0a37ddb70c..14e5846ddf 100644
--- a/webpack.config.js
+++ b/webpack.config.js
@@ -65,6 +65,10 @@ module.exports = {
},
}),
],
+ splitChunks: {
+ chunks: 'async',
+ name: (_, chunks) => chunks.map((item) => item.name).join('-'),
+ }
},
module: {
rules: [
@@ -142,10 +146,8 @@ module.exports = {
}),
new SourceMapDevToolPlugin({
filename: 'js/[name].js.map',
- exclude: [
- 'js/gitgraph.js',
- 'js/jquery.js',
- 'js/swagger.js',
+ include: [
+ 'js/index.js',
],
}),
],
@@ -153,7 +155,9 @@ module.exports = {
maxEntrypointSize: 512000,
maxAssetSize: 512000,
assetFilter: (filename) => {
- return !filename.endsWith('.map') && filename !== 'js/swagger.js';
+ if (filename.endsWith('.map')) return false;
+ if (['js/swagger.js', 'js/highlight.js'].includes(filename)) return false;
+ return true;
},
},
resolve: {