mantrajs / mantra-cli

Command line interface for building Meteor apps with Mantra
MIT License
135 stars 34 forks source link

Generating publications/methods and collections issue #92

Open srbdev opened 8 years ago

srbdev commented 8 years ago

Using Meteor 1.3.x, when creating a collection and then creating its respective publication and methods, Meteor crashes when running the server with an "Unable to resolve some modules:" error. The generated import is:

import {MyCollection} from '/lib/collections';

but it needs to be modified to the following for the error to go away:

import {MyCollection} from '../../lib/collections';
macrozone commented 8 years ago

Hi @srbdev I think you have to add the babel-root-slash-import plugin to your babelrc:

{
  "presets": ["es2015", "stage-2", "react"],
  "plugins": ["react-require", "babel-root-slash-import",
   ....]
}

then, it can resolve imports that begin with "/" and are relative to your app-root

srbdev commented 7 years ago

@macrozone I already have the entry in my .babelrc and the issue is still happening

sungwoncho commented 7 years ago

@srbdev are you using the latest version of babel-root-slash-import? See https://talk.mantrajs.com/t/meteor-1-3-3-and-imports/360/7