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
{{ message }}
This repository was archived by the owner on Mar 22, 2026. It is now read-only.
Repository navigation
This repository was archived by the owner on Mar 22, 2026. It is now read-only.
Hmm, except my understanding was that modules published on npm were supposed to be pre-compiled, ie having only simple (ES5) source files as their main entrypoint. Which is why it's not normally needed to require users to edit their webpack config.
Is there any reason why this can't be pre-compiled?
You are correct @TMiguelT with a caveat. NPM packages will normally come with multiple compilations of the code. CommonJS, AMD, UMD, ES Modules, etc... It looks like this library is getting compiled to both UMD and ES Modules, but currently only marking the ES Module for consumption in package.json. In many libraries, you will see the main set to the UMD version and the module set to the ES Module, here both are set to es. If you want to use the compiled and minified version, you should pull in the /dist/jsoneditor-react.min.js file.
However, looking at the Webpack loaders you are adding, those are for CSS and SVG. The JS being ES6 or ES5, or whatever should have no effect on needing those loaders.
The CSS and SVG loaders are required here, because this module directly imports CSS from JavaScript, which is obviously not going to work without a loader:
Activity
vankop commentedon Sep 25, 2019
You are right. I will label this as "help wanted". PRs wellcome 👍
multimeric commentedon Oct 3, 2019
Hmm, except my understanding was that modules published on npm were supposed to be pre-compiled, ie having only simple (ES5) source files as their
mainentrypoint. Which is why it's not normally needed to require users to edit their webpack config.Is there any reason why this can't be pre-compiled?
TreTuna commentedon Nov 27, 2019
You are correct @TMiguelT with a caveat. NPM packages will normally come with multiple compilations of the code. CommonJS, AMD, UMD, ES Modules, etc... It looks like this library is getting compiled to both UMD and ES Modules, but currently only marking the ES Module for consumption in
package.json. In many libraries, you will see themainset to the UMD version and themoduleset to the ES Module, here both are set toes. If you want to use the compiled and minified version, you should pull in the/dist/jsoneditor-react.min.jsfile.However, looking at the Webpack loaders you are adding, those are for CSS and SVG. The JS being ES6 or ES5, or whatever should have no effect on needing those loaders.
multimeric commentedon Nov 27, 2019
The CSS and SVG loaders are required here, because this module directly imports CSS from JavaScript, which is obviously not going to work without a loader:
jsoneditor-react/src/Editor.jsx
Lines 4 to 5 in 0d805ce
vankop commentedon Dec 28, 2019
added info in readme
kushagra010 commentedon Jan 12, 2023
@vankop @multimeric I use tsup, is there any alterative for that ?
I tried the following, but no luck.