dev-jim
dev-jim

Reputation: 2524

Meteor 1.3 import module errors

I have a project with the following structure :

Project : 
   -client
        -layouts
          -mainlayouts.jsx
        -components
          -homepage.jxs
   -lib
        -routes.jsx

So in my routes.jsx I want to import module from mainlayouts and hompepage, and this is what I did:

import {MainLayout} from '../client/layouts/mainlayouts.jsx';
import HomePage from '../client/templates/homepage.jxs';

But I got this error:

Error: Cannot find module '../client/layouts/mainlayouts.jsx'

What did I do wrong?

Upvotes: 0

Views: 179

Answers (1)

saimeunt
saimeunt

Reputation: 22696

Try using an "absolute" path instead :

/client/layouts/mainlayouts.jsx

By "absolute", I mean relative to your meteor project root, which is a meteor specific feature of ES2015 module imports.

Upvotes: 1

Related Questions