json-schema-form / json-schema-form-core

Core library
MIT License
65 stars 13 forks source link

could not use this as npm lib. #4

Open jmfrancois opened 7 years ago

jmfrancois commented 7 years ago

Enhancement

As a developer, when I install json-schema-form-core

Expected behaviour

I expect to be able to require the library. I'm looking at refactor our react-talend-forms package using the uischema of schemaform.io. At the moment this is a fork of react-jsonschema-form;

It seems json-schema-form-core is what I'm looking for and I would like to use it. So for that I expect to be able to just import it and use it.

Actual behaviour

It fails with the following error:

ReferenceError: tv4 is not defined
    at Object.eval (webpack:///./~/json-schema-form-core/dist/json-schema-form-core.js?:2623:18)
    at __webpack_require__ (webpack:///./~/json-schema-form-core/dist/json-schema-form-core.js?:29:30)
    at Object.module.exports.ObjectPath.parse.i (webpack:///./~/json-schema-form-core/dist/json-schema-form-core.js?:2452:62)
    at __webpack_require__ (webpack:///./~/json-schema-form-core/dist/json-schema-form-core.js?:29:30)
    at Object.module.exports._typeof (webpack:///./~/json-schema-form-core/dist/json-schema-form-core.js?:491:72)
    at __webpack_require__ (webpack:///./~/json-schema-form-core/dist/json-schema-form-core.js?:29:30)
    at Object.eval (webpack:///./~/json-schema-form-core/dist/json-schema-form-core.js?:2629:18)
    at __webpack_require__ (webpack:///./~/json-schema-form-core/dist/json-schema-form-core.js?:29:30)
    at module.exports.Object.defineProperty.value (webpack:///./~/json-schema-form-core/dist/json-schema-form-core.js?:75:18)
    at Object.eval (webpack:///./~/json-schema-form-core/dist/json-schema-form-core.js?:78:10)

or just with node:

> var test = require('json-schema-form-core')
ReferenceError: tv4 is not defined
    at Object.<anonymous> (/Users/jmfrancois/github/talend/ui/packages/forms/node_modules/json-schema-form-core/dist/json-schema-form-core.js:2623:18)
    at __webpack_require__ (/Users/jmfrancois/github/talend/ui/packages/forms/node_modules/json-schema-form-core/dist/json-schema-form-core.js:29:30)
    at Object.module.exports.ObjectPath.parse.i (/Users/jmfrancois/github/talend/ui/packages/forms/node_modules/json-schema-form-core/dist/json-schema-form-core.js:2452:62)
    at __webpack_require__ (/Users/jmfrancois/github/talend/ui/packages/forms/node_modules/json-schema-form-core/dist/json-schema-form-core.js:29:30)
    at Object.module.exports._typeof (/Users/jmfrancois/github/talend/ui/packages/forms/node_modules/json-schema-form-core/dist/json-schema-form-core.js:491:72)
    at __webpack_require__ (/Users/jmfrancois/github/talend/ui/packages/forms/node_modules/json-schema-form-core/dist/json-schema-form-core.js:29:30)
    at Object.<anonymous> (/Users/jmfrancois/github/talend/ui/packages/forms/node_modules/json-schema-form-core/dist/json-schema-form-core.js:2629:18)
    at __webpack_require__ (/Users/jmfrancois/github/talend/ui/packages/forms/node_modules/json-schema-form-core/dist/json-schema-form-core.js:29:30)
    at module.exports.Object.defineProperty.value (/Users/jmfrancois/github/talend/ui/packages/forms/node_modules/json-schema-form-core/dist/json-schema-form-core.js:75:18)
    at Object.<anonymous> (/Users/jmfrancois/github/talend/ui/packages/forms/node_modules/json-schema-form-core/dist/json-schema-form-core.js:78:10)

In my opinion the issue comes from the build which should be more a babel transpilation instead of webpack build which target bundle.

Are you opened to PR to fix this ?

Anthropic commented 7 years ago

@jmfrancois can you message me on gitter? Same username.

jmfrancois commented 7 years ago

https://github.com/networknt/react-schema-form is a react implementation of schemaform.io but it doesn't use this lib. so unexpected differences :/ would like to have / achieve something in common. I'm connected on gitter

Anthropic commented 6 years ago

As an update, I have almost finished a TypeScript conversion, which will output multiple compatible versions for use in other applications as I am migrating to a build process that copies RxJS' build steps and library structure to optimise webpack builds using the library.

I have also create www.github.com/jsonschema/assimilate to assist in removing the tv4 dependency and that library is structured in the same way as this library by following RxJS as a guide.

I should have a release soon, I just need to update all the tests and of course to document it all.