json-schema-merge-allof icon indicating copy to clipboard operation
json-schema-merge-allof copied to clipboard

Package does not get transpiled when used with webpack/babel

Open jnachtigall opened this issue 4 years ago • 4 comments

I am using this as dependency/part of https://github.com/rjsf-team/react-jsonschema-form/ and arrow functions and ... rest operator where not transpiled, that is, the app was not running in IE11.

I guess when publishing to npm the package should be transpiled.

I fixed locally with having this workaround in my webpack.config.js, that is, adding the package to be resolved locally:

        {
          test: /\.(js|jsx)$/,
          include: [
            path.resolve("src"),
            path.resolve("./node_modules/json-schema-compare"),
            path.resolve("./node_modules/json-schema-merge-allof")
          ],
          loader: "babel-loader",
        },

jnachtigall avatar May 29 '20 08:05 jnachtigall

Probably something like

https://github.com/rjsf-team/react-jsonschema-form/blob/ed7b5033d27950e6e15ec80d07ed483f0439c885/packages/core/package.json#L6-L15

and

https://github.com/rjsf-team/react-jsonschema-form/blob/ed7b5033d27950e6e15ec80d07ed483f0439c885/packages/core/package.json#L29-L35

would need to be added

jnachtigall avatar May 29 '20 09:05 jnachtigall

See also https://www.robinwieruch.de/publish-npm-package-node for a tutorial for this

jnachtigall avatar May 29 '20 11:05 jnachtigall

I know I should send a PR but no time :) just for the record, this is a problem easy to hit with setups like Create-React-App, see https://github.com/facebook/create-react-app/issues/6195#issuecomment-454400327

jnachtigall avatar Jun 04 '20 14:06 jnachtigall

@jnachtigall your workaround seems interesting. I tried it but I get

Uncaught Error: Cannot find module 'core-js/modules/es.symbol.js'
    at webpackMissingModule (index.js:1)
    at eval (index.js:1)
    at Object.../node_modules/json-schema-merge-allof/src/index.j

Do you have any idea about it?

snuzi avatar Mar 31 '21 14:03 snuzi