-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Doesn't work with formio.js [BUG] #2
Comments
remove the |
It also seems odd that package.json does not include 'formiojs' which is imported in /src/components/CheckMatrix/CheckMatrix.ts. |
formiojs is a peerDependency and that is intended. The reason for this is we want the users who are including this library to already have formiojs installed as a dependency and we should be using that instance of that library instead of the one included from this library. This actually resolves a pretty significant issue where the components would get registered on the wrong formiojs instance. |
so it seems I'm barking up the wrong tree - I'm trying to understand how to create a custom component based on this example. |
Here's a working example for a custom component I've been working on. You just need this single file, then add the component to the Builder custom menu to get at it.
|
The "npm install" probably fails because we need to include the formiojs library as a "devDependency" as well as a "peerDependency" so that the build can still be completed. That is an easy change to make and should not block using the contrib library as a model to create custom components. Moving forward, this is our recommended way of creating Custom components since it provides customers a template to be able to have their own library of custom components and also includes a way of compiling them so that they work with all browsers (using webpack + typescript). |
While your answer is over 2 years old now, @travist, the repo hasn't changed for over 3 years. I feel that to really build a community around formiojs, a clear and straight-forward on-boarding experience is mandatory. Scanning open issues for valuable hints buried in comments is not something that should be expected before getting started. As you've stated:
So, please, make the necessary changes - as small as they may be - and add a "Getting started" paragraph in your Readme that covers not the usage but the development of this module. Thank you. |
Closing this thread as it is outdated. Please re-open if it is still relevant. Thank you for your contribution! |
Ok, just tried to check this out and do npm install.
Doesn't compile:
$ npm install
npm WARN prepublish-on-install As of npm@5,
prepublish
scripts are deprecated.npm WARN prepublish-on-install Use
prepare
for build steps andprepublishOnly
for upload-only.npm WARN prepublish-on-install See the deprecation note in
npm help scripts
for more information.src/components/CheckMatrix/CheckMatrix.form.ts:1:33 - error TS2307: Cannot find module 'formiojs/components/_classes/nested/NestedComponent.form'.
1 import nestedComponentForm from 'formiojs/components/_classes/nested/NestedComponent.form';
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/components/CheckMatrix/CheckMatrix.ts:6:28 - error TS2307: Cannot find module 'formiojs'.
6 import { Components } from 'formiojs';
~~~~~~~~~~
src/use.ts:1:24 - error TS2307: Cannot find module 'formiojs'.
1 import { Formio } from 'formiojs';
~~~~~~~~~~
Found 3 errors.
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! @formio/contrib@1.1.0 build:
tsc && gulp templates && npm run webpack && node-sass ./src/sass/contrib.scss ./dist/formio-contrib.css
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the @formio/contrib@1.1.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/tagg/.npm/_logs/2020-05-04T14_16_11_268Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! @formio/contrib@1.1.0 prepublish:
npm run build
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the @formio/contrib@1.1.0 prepublish script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/tagg/.npm/_logs/2020-05-04T14_16_11_294Z-debug.log
The text was updated successfully, but these errors were encountered: