import React from 'react';
export default class Home extends React.Component {
render() {
return <div>
<Clock />
</div>
}
}
Notice there’s no import Clock from '../components/Clock.jsx', yet this still works without any errors or warnings. It seems like Meteor is not being strict about having to use export/import?
If you are familiar with modules in Node, you might expect modules not to be evaluated until the first time you import them. However, because earlier versions of Meteor evaluated all of your code when the application started, and we care about backwards compatibility, eager evaluation is still the default behavior.
If you would like a module to be evaluated lazily (in other words: on demand, the first time you import it, just like Node does it), then you should put that module in an imports/ directory (anywhere in your app, not just the root directory), and include that directory when you import the module: import {stuff} from “./imports/lazy”.
So, moving the definition of Clock into /client/imports/components made this work as expected.