Skip to content

Change sourcemap and add a small increase to chunkSizeWarningLimit - #4250

Merged
OyvindLGjesdal merged 1 commit into
apache:mainfrom
OyvindLGjesdal:chunk-size
Nov 2, 2026
Merged

OyvindLGjesdal merged 1 commit into
apache:mainfrom
OyvindLGjesdal:chunk-size

Conversation

@OyvindLGjesdal

@OyvindLGjesdal OyvindLGjesdal commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

to handle vite chunk size warning

  • change sourcemap to true (json is published, if inline as currently, currently increases query chunk by around 5 MB for Query, total size: 6,143.12 kB )
  • use popover dist over component import for slightly smaller bundle
  • Remove Bootstrap's CSS (imported twice)
  • Only import used bootstrap components (collapse in main)
  • Increase chunk size to account for change introduced by geo module (target/webapp/static/geo-BWNODv4T.js 154.80 kB, if split to its own chunk)

GitHub issue resolved #

Currently the largest js generated by vite is around 5 MB larger than its limit (6.1 vs 1.25). The main culprit seems to be the option for inline sourcemap, which includes it as part of the bundle.

The default value for sourcemap is false, which would prevent it from being built, and getting relevant debug info out of the minified js.

Options are false, true, 'inline' or 'hidden'. https://vite.dev/config/build-options#build-sourcemap

true and 'hidden' both generate it as a json file, so that it becomes part of the build artifacts. Afaik true means that it is configured while'"hidden"' means that you'd have to let the browser debugger know about the file existing, and its path. If I understand correctly, inline appends it to the file as a data url.

I have configured it to use true for now, but am wondering what would be the preferred configuration.

Pull request Description:

[INFO] computing gzip size...
[INFO] target/webapp/index.html                                                1.71 kB │ gzip:     0.93 kB
[INFO] target/webapp/static/Query-9GA7lavO.css                                62.81 kB │ gzip:    14.05 kB
[INFO] target/webapp/static/index-BGed2oCz.css                               338.80 kB │ gzip:    44.69 kB
[INFO] target/webapp/static/rolldown-runtime-hePW80VL.js                       0.71 kB │ gzip:     0.42 kB
[INFO] target/webapp/static/utils-CI35ZyFj.js                                  1.80 kB │ gzip:     1.13 kB │ map:     1.23 kB
[INFO] target/webapp/static/Help-BuStP6Fs.js                                   3.39 kB │ gzip:     1.93 kB │ map:     1.91 kB
[INFO] target/webapp/static/Menu-b5jAr5gv.js                                   5.06 kB │ gzip:     2.50 kB │ map:     2.98 kB
[INFO] target/webapp/static/Tasks-DYTwwcUH.js                                  8.26 kB │ gzip:     3.72 kB │ map:     4.96 kB
[INFO] target/webapp/static/current-dataset-navigation-guards-D8szdkyj.js     13.93 kB │ gzip:     6.09 kB │ map:     8.60 kB
[INFO] target/webapp/static/NewDataset-Dx22eX-8.js                            13.96 kB │ gzip:     5.42 kB │ map:     8.30 kB
[INFO] target/webapp/static/ExistingDatasets-zlniQoky.js                      22.96 kB │ gzip:     7.35 kB │ map:    13.60 kB
[INFO] target/webapp/static/Info-DpnnSNL_.js                                  28.16 kB │ gzip:     9.40 kB │ map:    16.91 kB
[INFO] target/webapp/static/Upload-B5KJE7ZQ.js                               235.51 kB │ gzip:    60.57 kB │ map:   147.05 kB
[INFO] target/webapp/static/bootstrap.esm-UQYbihn9.js                        488.99 kB │ gzip:   127.92 kB │ map:   306.47 kB
[INFO] target/webapp/static/_plugin-vue_export-helper-DWU1xS_z.js            676.24 kB │ gzip:   185.40 kB │ map:   462.94 kB
[INFO] target/webapp/static/Edit-BjM_7em5.js                               2,656.20 kB │ gzip:   719.11 kB │ map: 1,690.20 kB
[INFO] target/webapp/static/index-Dlo3f5zL.js                              3,237.32 kB │ gzip:   958.13 kB │ map: 2,168.61 kB
[INFO] target/webapp/static/Query-C1S9GXvj.js                              6,143.12 kB │ gzip: 1,516.95 kB │ map: 3,607.46 kB
[INFO] 
[ERROR] [EVAL] Use of direct `eval` function is strongly discouraged as it poses security risks and may cause issues with minification.
[ERROR]       ╭─[ node_modules/@zazuko/yasqe/build/yasqe.esm.js:7023:104 ]
[ERROR]       │
[ERROR]  7023 │          })), rx_one.test(text.replace(rx_two, "@").replace(rx_three, "]").replace(rx_four, ""))) return j = eval("(" + text + ")"), typeof reviver == "function" ? walk({ "": j }, "") : j;
[ERROR]       │                                                                                                              ──┬─  
[ERROR]       │                                                                                                                ╰─── Use of direct `eval` here.
[ERROR]       │ 
[ERROR]       │ Help: Consider using indirect eval. For more information, check the documentation: https://rolldown.rs/guide/troubleshooting#avoiding-direct-eval
[ERROR] ──────╯
[ERROR] 
[ERROR] [plugin builtin:vite-reporter] 
[ERROR] (!) Some chunks are larger than 1250 kB after minification. Consider:
[ERROR] - Using dynamic import() to code-split the application
[ERROR] - Use build.rolldownOptions.output.codeSplitting to improve chunking: https://rolldown.rs/reference/OutputOptions.codeSplitting
[ERROR] - Adjust chunk size limit for this warning via build.chunkSizeWarningLimit.

comparable output from changed build:

vite v8.2.2 building client environment for production...
✓ 255 modules transformed.
computing gzip size...
target/webapp/index.html                                                1.62 kB │ gzip:   0.90 kB
target/webapp/static/Query-9GA7lavO.css                                62.81 kB │ gzip:  14.05 kB
target/webapp/static/index-DcSw8Duk.css                               226.99 kB │ gzip:  31.28 kB
target/webapp/static/utils-CI35ZyFj.js                                  0.14 kB │ gzip:   0.13 kB │ map:     1.23 kB
target/webapp/static/Help-BuStP6Fs.js                                   0.82 kB │ gzip:   0.47 kB │ map:     1.91 kB
target/webapp/static/Menu-DNzNtf1L.js                                   1.05 kB │ gzip:   0.51 kB │ map:     2.98 kB
target/webapp/static/Tasks-DhrMjopN.js                                  1.62 kB │ gzip:   0.80 kB │ map:     4.96 kB
target/webapp/static/current-dataset-navigation-guards-CbKQ6L78.js      2.46 kB │ gzip:   0.99 kB │ map:     8.60 kB
target/webapp/static/NewDataset-CuMd4YHr.js                             2.87 kB │ gzip:   1.29 kB │ map:     8.30 kB
target/webapp/static/ExistingDatasets-B0J600N9.js                       4.83 kB │ gzip:   1.71 kB │ map:    13.62 kB
target/webapp/static/Info-C77UtWZG.js                                   5.61 kB │ gzip:   2.11 kB │ map:    16.92 kB
target/webapp/static/popover-C3D_8tuo.js                               36.35 kB │ gzip:  12.39 kB │ map:   151.02 kB
target/webapp/static/Upload-COIMYvSl.js                                39.42 kB │ gzip:  12.29 kB │ map:   147.05 kB
target/webapp/static/_plugin-vue_export-helper-DWU1xS_z.js             58.97 kB │ gzip:  23.19 kB │ map:   462.94 kB
target/webapp/static/index-CKgJGN3L.js                                282.25 kB │ gzip:  89.82 kB │ map: 2,062.09 kB
target/webapp/static/Edit-Bv4ZcmjB.js                                 402.57 kB │ gzip: 129.86 kB │ map: 1,690.20 kB
target/webapp/static/Query-BUidELIM.js                              1,333.10 kB │ gzip: 387.95 kB │ map: 3,607.46 kB

Did also try to chunk using codeSplitting and split out the geo dependency for the frontend, but it became sort of complicated due to having to run codeSplit when running test, while codeSplitting for the production bundle.
So I rather slightly increased the limit with 100 kb.


  • Tests are included.
  • Documentation change and updates are provided for the Apache Jena website
  • Commits have been squashed to remove intermediate development commit messages.
  • Key commit messages start with the issue number (GH-xxxx)

By submitting this pull request, I acknowledge that I am making a contribution to the Apache Software Foundation under the terms and conditions of the Contributor's Agreement.


See the Apache Jena "Contributing" guide.

@OyvindLGjesdal
OyvindLGjesdal marked this pull request as draft September 22, 2026 21:14
@OyvindLGjesdal

OyvindLGjesdal commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor Author

I think sourcemap: true is nice for having readable stack traces by default, e.g if someone reports a bug, and they inspected it in the web console. 'inline' works the same way, but also downloads the source map as part of the js bundle. But to be clear, I haven't done much work or debugging using sourcemaps, so not an authority.

Edit:

See filesize from extracted zip in jena/jena-fuseki2/apache-jena-fuseki/target, after a build on the SNAPSHOT with different sourcemap configs:

  • false 54185002 fuseki-server.jar
  • 'Inline' 57001821 fuseki-server.jar (current config in main)
  • true 56132908 fuseki-server.jar

@OyvindLGjesdal

Copy link
Copy Markdown
Contributor Author

I think true makes most sense for the sourcemap setting. Then users can inspect using the browser dev tools for reporting bugs, and we shrink the shipped bundles to 1/5 and afaik only loads if the dev tools are opened . It also slightly shrinks the fuseki-server.jar. New test for using the collapse menu in e2e and the unused attributes were found by AI, as well as discussion of the options.

@OyvindLGjesdal
OyvindLGjesdal marked this pull request as ready for review October 14, 2026 21:11
@OyvindLGjesdal

Copy link
Copy Markdown
Contributor Author

Hi @kinow does this look ok to you? I could maybe remove the changed attributes and the cy test for the collapsed menu on a small viewport, which were cleanups suggested by Claude, to only focus and fix the bundle size.

By the way, I did a first pass at looking at boostrap 6 alpha https://github.com/OyvindLGjesdal/jena/tree/bootstrap6-alpha, which has skills in the bootstrap repo for the migration. Still early with the alpha release, but it looks promising.

@OyvindLGjesdal
OyvindLGjesdal requested a review from kinow November 1, 2026 22:45

@kinow kinow left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@OyvindLGjesdal if the menu is displaying correctly, then I think that's OK to keep them. I haven't done JS in a while, so I'm a bit rusty. Thanks for including the info about true/inline (I didn't remember it! 😆 ).

No objection from me to use sourcemap: true. The only thing I'd try, is accessing the browser developer tools, and search for some code from the UI. If you can navigate with the browser, then that means that the sourcemap is working.

I guess using true, the sourcemap will be downloaded only when requested by the browser, and not by all users by default, so that'd be better for production/general users.

Thanks!!!

@OyvindLGjesdal

Copy link
Copy Markdown
Contributor Author

Thank you @kinow for checking it out, I'll try if I can navigate with the browser and inspect the small menu manually

* Move source maps out of the bundles (sourcemap 'inline' -> true);
  browsers only fetch the .map files when devtools is open
* Only import the Bootstrap components in use (collapse in main,
  popover in the dataset info and manage views)
* Remove Bootstrap's prebuilt CSS, which was included twice
* Remove data-bs-* attributes that no Bootstrap plugin handles
* Add an e2e test for opening and closing the collapsed navbar menu
* Increase chunkSizeWarningLimit for the geo module
  (target/webapp/static/geo-BWNODv4T.js 154.80 kB, if split to its own)
@OyvindLGjesdal

Copy link
Copy Markdown
Contributor Author

Both looks good to me:

Skjermbilde 2026-11-02 kl  21 35 28

When comparing to main I noticed on the manage tab that collapse fails after opening the menu (it only opens), so looks like it also fixed a minor bug.
Skjermbilde 2026-11-02 kl  22 00 44

@OyvindLGjesdal
OyvindLGjesdal merged commit c9b6b49 into apache:main Nov 2, 2026
1 check passed
@kinow

kinow commented Nov 2, 2026

Copy link
Copy Markdown
Member

Great, and thanks for fixing the bug!!! 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AI Assisted Assisted or generated by AI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants