feats / babel-plugin-inline-import

inline the raw content of import statements
https://www.npmjs.com/package/babel-plugin-inline-import
MIT License
243 stars 29 forks source link

Allow direct import of file #13

Closed gnowth closed 7 years ago

gnowth commented 7 years ago

importing a file without assigning it to a variable causes an error TypeError: Cannot read property 'local' of undefined

import './example.txt';
smeijer commented 6 years ago

Why was this one closed? It's still a thing, especially in Meteor projects. Where we need to import templates with import './Dialog.html'.

As a workaround, we can use import template from './Dialog.html', but good coding standards will complain about template is defined but not being used.

So what I'm currently doing, but not really liking; is that I have two type of html files. Meteor templates have an .html extension, while inline-imported files use .htm. Combined with a .babelrc that only looks for .htm files, it works. But it ain't pretty.