How to return autoimport in latest releases of Meteor?

#1

Some time ago in Meteor 1.5 all of autoimport is going great, you can just write

Template.tplName.helpers({...})

and it will be working code, but now you must write imports

import { Template } from 'meteor/templating';
import './some_templates.html';
Template.tplName.helpers({...})

It brokes Meteor ideals of magic! Ideals when you’re writing code very fast, without any things in mind like “Have I imported this? And this?”, and if not - you’ve got errors. It’s unusual for me.

Cos I wrote this topic: how i can return old automatic import in latest release of Meteor? If I can’t - please tell me, I’ll continue using more elder releases…

#2

Yes you can. Open up the package.json file and delete the "meteor" section.
The meteor section defines the entry points for import-only syntax, removing these falls back to the old behaviour

#3

its possible, but poorly documented. See this PR: https://github.com/meteor/meteor/pull/9690 or this changelog: https://docs.meteor.com/changelog.html#changes-9

basically, in your package.json, you have to remove meteor. mainModule from your package.json

having said that: i still highly recommend to use imports, in particular if your project gets larger

#4

Thank you for your care, I’ll try to use imports in big projects. :grinning:

#5

It should really be the default.

#6

This has been long debated and the benefits of alignment with the rest of the javascript developer community and tooling outweighed the costs. Especially when it is optional and backwards compatible

1 Like
#7

Yep, now created project from scratch - meteor block does not exist