default export is not declared in imported module
11,223
Solution 1
try this:
import * as tpl from './tpmInfo.tpl.html'
and then use it like this:
template: tpl.template,
Let me know if this works for you.
Solution 2
For Angular2-Meteor projects I had to do like Wassim says, with small changes:
import * as tpl from './tpmInfo.tpl.html'
and then in Component
template: tpl.default
or
import * as templatefrom './tpmInfo.tpl.html';
template = template.default;
@Component({
//smth,
template
})
this is a string, returned by angular2-compilers
module
Comments
-
6324 almost 2 years
I am using ES6 in IntelliJ IDEA. Below is a piece of code.
import controller from './tpmInfo.ctrl.js' import template from './tpmInfo.tpl.html' //default export is not declared in imported module export default angular.module('tmpApp', []) .component('tpmInfo', { template: template, controller: controller, bindings: { ags: '=' } }) .name;
The
template
html is a normal html, but IntelliJ IDEA throws warning "default export is not declared in imported module". Is there any way to make this warning disappear? Thanks. -
Wassim Chegham almost 8 yearsBTW, what module loader or bundlers are you using? SystemJs? Webpack?
-
6324 almost 8 yearsWe are using Webpack.
-
6324 almost 8 yearsHi, can you revert your answer to the previous version? My code is in
app.js
so I don't have to set up Webpack here. Your previous answer works for me. Thanks! So the solution is:import * as template from './app.tpl.html'
andtemplate: template
.