导入模块中未声明默认导出

632*_*324 5 intellij-idea phpstorm webstorm angularjs ecmascript-6

我在IntelliJ IDEA中使用ES6。下面是一段代码。

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;
Run Code Online (Sandbox Code Playgroud)

templatehtml是普通的html,但是IntelliJ IDEA引发警告“在导入的模块中未声明默认导出”。有什么办法可以使该警告消失?谢谢。

Was*_*ham 9

尝试这个:

import * as tpl from './tpmInfo.tpl.html'
Run Code Online (Sandbox Code Playgroud)

然后像这样使用它:

template: tpl.template,
Run Code Online (Sandbox Code Playgroud)

让我知道这是否适合您。