You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
imported JSON will be transformed into export default JSON.parse("...") which is significantly more performant than Object literals, especially when the JSON file is large.
and this (rollup-plugin-json-parse) very old plugin, in certain cases especially with large json blobs, export JSON.parse("...") is significantly faster than exporting an object literal.
This functionality is already built into Vite by specifying json.stringify. The logic behind this is extrememly simple and seems fit to be added to the rollup plugin without causing any issues. Perhaps it could even have an option that would transform the object literals to strings if the json is detected to be over a certain size.
Feature Proposal
The plugin config would take an extra option stringify that returns JSON.parse("...") instead of being converted into an object literal. A further stringifySize (or other name) could take a size that, if exceeded, would automatically remove the object literal.
I would be willing to add this functionality if desired.
The text was updated successfully, but these errors were encountered:
plugin-json
Feature Use Case
As stated by Vite:
and this (rollup-plugin-json-parse) very old plugin, in certain cases especially with large json blobs, export
JSON.parse("...")
is significantly faster than exporting an object literal.This functionality is already built into Vite by specifying
json.stringify
. The logic behind this is extrememly simple and seems fit to be added to the rollup plugin without causing any issues. Perhaps it could even have an option that would transform the object literals to strings if the json is detected to be over a certain size.Feature Proposal
The plugin config would take an extra option
stringify
that returnsJSON.parse("...")
instead of being converted into an object literal. A furtherstringifySize
(or other name) could take a size that, if exceeded, would automatically remove the object literal.I would be willing to add this functionality if desired.
The text was updated successfully, but these errors were encountered: