2

first of all, I want to say that im a newbie in meteor and I been looking for a solution for 3 hours but I dont find it. I hope my question helps other newbies like me.

Im working with an Inspinia seed proyect and Im testing and learning how to use simple-schema, collection2 and autoform. I followed all the installation tutorial from that packages and it seems there is all correct. When I tried to create a simpleSchema and run meteor, the console says: "SyntaxError: import declarations may only appear at top level of a module"

I put "import SimpleSchema from 'simpl-schema'; SimpleSchema.extendOptions(['autoform']);" in the same .js where are my schemas. My question is where I have to put this 2 lines? What is the top of the module here? If I dont put this the error says "ReferenceError: SimpleSchema is not defined". I can see in node_modules/simpl-schema the package so I think is well add to the project. There is something im not understanding so I hope someone can help me. Im using METEOR@1.4.2.3 this might be the problem?

Sorry if this question is answered in other post, I try to look all the posts but I dont find it.

PD: English is not my language so excuse me if I write wrong.

Edit:

Here is where I put the import because I dont know where is this top of module. Where did I have to put it? schema.js is inside client Thanks for the help

MaxMayoris
  • 21
  • 3
  • 2
    You need to put your imports at the top of the file. Not inside a method, if statement or constructor. Edit your post and show us the code you have if you don't understand – Mikkel Sep 02 '17 at 02:09
  • By the way, with Meteor 1.5 there are also dynamic imports possible. But yes, please post your code here so that we can help you to solve this issue. The packages are very solid and widely used. – Jankapunkt Sep 02 '17 at 09:52
  • i just edit it, thx for the help guys – MaxMayoris Sep 03 '17 at 04:33

0 Answers0