Skip to content
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

use uniform without meteor #148

Closed
saeedjalalisj opened this issue Dec 14, 2016 · 25 comments
Closed

use uniform without meteor #148

saeedjalalisj opened this issue Dec 14, 2016 · 25 comments
Assignees
Labels
Type: Bug Bug reports and their fixes

Comments

@saeedjalalisj
Copy link

Hi, I want use uniform without meteor. can you show me an example??
I am using webpack and React.js + simpl-schma

@radekmie radekmie self-assigned this Dec 14, 2016
@radekmie radekmie added the Type: Question Questions and other discussions label Dec 14, 2016
@radekmie
Copy link
Contributor

Hey there!

There's nothing Meteor related in the README.md examples (only your schema definition may differ) and in the API.md. If you'll still encounter some issues - let me know.

@saeedjalalisj
Copy link
Author

saeedjalalisj commented Dec 18, 2016

@radekmie thanks for your reply. I'm trying below steps:

  1. First install npm install --save react react-dom uniforms uniforms-bootstrap3

  2. Then install npm install simpl-schema --save

  3. Then create schema.js file and write schema like this:

import SimpleSchema from 'simpl-schema';

const PersonSchema = new SimpleSchema({
    name: {
        type: String,
        min: 3,
        max: 50
    },

    age: {
        type: Number,
        min: 0,
        max: 150
    }
});

const PostSchema = new SimpleSchema({
    category: {
        type: String,
        allowedValues: [
            "news",
            "image",
            "video"
        ]
    },

    authors: {
        type: [PersonSchema],
        minCount: 1,
        maxCount: 3
    },

    publishedDate: {
        type: Date
    },

    published: {
        type: Boolean,
        optional: true
    }
});
 
export default PostSchema;
  1. And also create form.jsx
import React from 'react';
import {render} from 'react-dom';
import {AutoForm} from 'uniforms-bootstrap3';
import PostSchema from './schema.js';
const PostCreateForm = () =>
<AutoForm schema={PostSchema} onSubmit={doc => console.log(doc)} />
;
export default PostCreateForm;

But unfortunately when I run my project I give the below error as output:

WARNING in ./~/uniforms/lib/bridges/GraphQLBridge.js
Critical dependencies:
55:18-25 require function is used in a way in which dependencies cannot be statically extracted
 @ ./~/uniforms/lib/bridges/GraphQLBridge.js 55:18-25

WARNING in ./~/uniforms/lib/bridges/SimpleSchema2Bridge.js
Critical dependencies:
71:23-30 require function is used in a way in which dependencies cannot be statically extracted
 @ ./~/uniforms/lib/bridges/SimpleSchema2Bridge.js 71:23-30

WARNING in ./~/handlebars/lib/index.js
require.extensions is not supported by webpack. Use a loader instead.

WARNING in ./~/handlebars/lib/index.js
require.extensions is not supported by webpack. Use a loader instead.

WARNING in ./~/handlebars/lib/index.js
require.extensions is not supported by webpack. Use a loader instead.

ERROR in ./~/handlebars/lib/index.js
Module not found: Error: Cannot resolve module 'fs' in /home/username/projects/test3/Files/react/FormReact/node_modules/handlebars/lib
 @ ./~/handlebars/lib/index.js 17:11-24

@radekmie
Copy link
Contributor

That's a bug. I've found a solution to suppress Meteor's warning about a not found module. It's here. It looks like it broke non-meteor package resolvers... OK, I'll try to fix it.

@radekmie radekmie reopened this Dec 18, 2016
@radekmie radekmie added Type: Bug Bug reports and their fixes and removed Type: Question Questions and other discussions labels Dec 18, 2016
@radekmie
Copy link
Contributor

I've made a separate issue for it: #150.

@radekmie
Copy link
Contributor

It's fixed in v1.8.0.

@saeedjalalisj
Copy link
Author

@radekmie thanks for your rapid fix! You are hero 😉

@Astroxslurg
Copy link

Got the exact same bug using webpack and uniforms v1.15.0 and simpl-schema v0.2.3

@radekmie
Copy link
Contributor

@Astroxslurg what is the problem exactly?

@Astroxslurg
Copy link

Well, I did pretty much exactly the same as OP, and got exactly the same error.

I'm not in any trouble tho', because I'm just working on a small project atm and I solved my problem using standard HTML after I got stuck with Uniforms. But I thought I could mention the bug in case it were of any interest :)

@radekmie
Copy link
Contributor

Thank you for your time then. I'll get to it in a minute and let you know what's going on.

@Astroxslurg
Copy link

Great! :)
Let me know if you need more info or something

@radekmie
Copy link
Contributor

@Astroxslurg:

create-react-app reproduction
cd reproduction
npm i -S simpl-schema uniforms{,-unstyled}

I see warnings from both, handlebars and GraphQLBridge, but these are only warnings. What error exactly have you encountered?

@Astroxslurg
Copy link

Astroxslurg commented Mar 23, 2017

I also get theese kind of warnings:

WARNING in ./~/handlebars/lib/index.js
require.extensions is not supported by webpack. Use a loader instead.
@ ./~/message-box/dist/MessageBox.js 13:18-39
@ ./~/simpl-schema/dist/SimpleSchema.js
@ ./~/simpl-schema/dist/main.js
@ ./client/questions/classroom.jsx
@ ./client/core/main.jsx

but also this one error:

ERROR in ./~/handlebars/lib/index.js
Module not found: Error: Can't resolve 'fs' in '/home/username/pu-69/interlecture/interlecture/node_modules/handlebars/lib'
@ ./~/handlebars/lib/index.js 17:11-24
@ ./~/message-box/dist/MessageBox.js
@ ./~/simpl-schema/dist/SimpleSchema.js
@ ./~/simpl-schema/dist/main.js
@ ./client/questions/classroom.jsx
@ ./client/core/main.jsx

@radekmie
Copy link
Contributor

It seem to be a handlebars/webpack problem. Long story short simpl-schema -> message-box -> handlebars. I can't help you then, but I hope these workarounds will suffice.

@Astroxslurg
Copy link

All right! Thanks for your time, once again, @radekmie :)

@waheed25
Copy link

waheed25 commented Aug 3, 2017

which packege i have to update to avoid these warnings ??
simpleschema or uniforms??

@radekmie
Copy link
Contributor

radekmie commented Aug 3, 2017

@waheed25: which warnings?

@waheed25
Copy link

waheed25 commented Aug 7, 2017

meteor warnings

@radekmie
Copy link
Contributor

radekmie commented Aug 7, 2017

@waheed25: there are no Meteor warnings for a long time now - just update the uniforms package. And by the way - this issue is about non-Meteor warnings.

@theluk
Copy link

theluk commented Oct 31, 2017

it seems the warnings still appear in webpack + uniforms + uniforms-bootstrap3

"webpack": "^3.8.1",
"react": "^16.0.0",
"uniforms": "^1.22.0",
"uniforms-bootstrap3": "^1.22.0",

when doing the following

import AutoForm from 'uniforms-bootstrap3/AutoForm';

then webpack triggers following warnings

WARNING in ./node_modules/uniforms/GraphQLBridge.js                                                                                           
Module not found: Error: Can't resolve 'graphql' in '/home/app/node_modules/uniforms'                                       
 @ ./node_modules/uniforms/GraphQLBridge.js 48:14-26                                                                                          
 @ ./node_modules/uniforms/createSchemaBridge.js                                                                                              
 @ ./node_modules/uniforms/BaseForm.js                                                                                                        
 @ ./node_modules/uniforms-bootstrap3/BaseForm.js                                                                                             
 @ ./node_modules/uniforms-bootstrap3/ValidatedQuickForm.js                                                                                   
 @ ./node_modules/uniforms-bootstrap3/AutoForm.js                                                                                                                    
 @ ./src/app/js/index.js                                                                                                                      
 @ multi ./src/app/js/index.js                                                                                                                
                                                                                                                                              
WARNING in ./node_modules/uniforms/SimpleSchemaBridge.js                                                                                      
Module not found: Error: Can't resolve 'meteor/aldeed:simple-schema' in '/home/app/node_modules/uniforms'                   
 @ ./node_modules/uniforms/SimpleSchemaBridge.js 84:23-55                                                                                     
 @ ./node_modules/uniforms/createSchemaBridge.js                                                                                              
 @ ./node_modules/uniforms/BaseForm.js                                                                                                        
 @ ./node_modules/uniforms-bootstrap3/BaseForm.js                                                                                             
 @ ./node_modules/uniforms-bootstrap3/ValidatedQuickForm.js                                                                                   
 @ ./node_modules/uniforms-bootstrap3/AutoForm.js                                                                                                                          
 @ ./src/app/js/index.js                                                                                                                      
 @ multi ./src/app/js/index.js                                                                                                                
                                                                                                                                              
WARNING in ./node_modules/uniforms/SimpleSchemaBridge.js                                                                                      
Module not found: Error: Can't resolve 'meteor/check' in '/home/app/node_modules/uniforms'                                  
 @ ./node_modules/uniforms/SimpleSchemaBridge.js 80:16-33                                                                                     
 @ ./node_modules/uniforms/createSchemaBridge.js                                                                                              
 @ ./node_modules/uniforms/BaseForm.js                                                                                                        
 @ ./node_modules/uniforms-bootstrap3/BaseForm.js                                                                                             
 @ ./node_modules/uniforms-bootstrap3/ValidatedQuickForm.js                                                                                   
 @ ./node_modules/uniforms-bootstrap3/AutoForm.js                                                                                                                                     
 @ ./src/app/js/index.js                                                                                                                      
 @ multi ./src/app/js/index.js                                                                                                                
                                                                                                                                              
WARNING in ./node_modules/uniforms/SimpleSchema2Bridge.js                                                                                     
Module not found: Error: Can't resolve 'simpl-schema' in '/home/app/node_modules/uniforms'                                  
 @ ./node_modules/uniforms/SimpleSchema2Bridge.js 60:19-36                                                                                    
 @ ./node_modules/uniforms/createSchemaBridge.js                                                                                              
 @ ./node_modules/uniforms/BaseForm.js                                                                                                        
 @ ./node_modules/uniforms-bootstrap3/BaseForm.js                                                                                             
 @ ./node_modules/uniforms-bootstrap3/ValidatedQuickForm.js                                                                                   
 @ ./node_modules/uniforms-bootstrap3/AutoForm.js                                                                                                          
 @ ./src/app/js/index.js                                                                                                                      
 @ multi ./src/app/js/index.js  

@radekmie
Copy link
Contributor

radekmie commented Nov 1, 2017

Yep it is, because there's no way to hide them. There's an idea to split schemas in future releases, but definitely not in @1.x.y as it's a breaking change.

@redbmk
Copy link

redbmk commented Mar 14, 2018

@radekmie Is there another open ticket for this? Seems like if this is going to be fixed in 2.x it should be on someone's radar, but this ticket is closed. It would be a shame if version 2 came out without fixing this.

@radekmie
Copy link
Contributor

@redbmk it is on our roadmap.

@lmachens
Copy link

lmachens commented Nov 6, 2018

I am facing the same issue (#148 (comment)).
Any updates here?

@radekmie
Copy link
Contributor

radekmie commented Nov 6, 2018

Not really. Nothing changed in terms of expressing dependencies, nor uniforms@2 are on the way (yet).

@Monteth Monteth added this to Closed in Open Source (migrated) Jun 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Bug reports and their fixes
Projects
Archived in project
Development

No branches or pull requests

7 participants