mantra-cli icon indicating copy to clipboard operation
mantra-cli copied to clipboard

Generating publications/methods and collections issue

Open srbdev opened this issue 7 years ago • 3 comments

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';

srbdev avatar Aug 25 '16 15:08 srbdev

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

macrozone avatar Sep 09 '16 08:09 macrozone

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

srbdev avatar Sep 09 '16 20:09 srbdev

@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

sungwoncho avatar Sep 09 '16 23:09 sungwoncho