-
-
Notifications
You must be signed in to change notification settings - Fork 433
Closed
Description
I use these loader.
"ts-loader": "^5.3.2",
"typescript": "^3.1.6",
"webpack": "^4.23.1",
"webpack-cli": "^3.1.2",
and my code is:
//hmwnav.ts
import './hmwnav.css';
import $ = require("jquery");
let hmwnav = {
init:function(){
console.log('hmwnav init');
return 'ok';
},
click:function(){
alert('ok');
return 'ok';
}
}
export = hmwnav;
//index-index.entry.ts
import hmwcommon from '../../components/hmwcommon/hmwcommon'
import hmwheader from '../../components/hmwheader/hmwheader'
import hmwnav = require('../../components/hmwnav/hmwnav')
import hmwmain from '../../components/hmwmain/hmwmain'
hmwnav.init();
hmwheader.init();
hmwcommon.init();
hmwmain.init();
and then I got an error:
Uncaught TypeError: hmwnav.init is not a function
at eval (index-index.entry.ts:7)
at Object../src/webapp/views/index/index-index.entry.ts (index-index.bundle.js:55)
at __webpack_require__ (runtime.bundle.js:79)
at checkDeferredModules (runtime.bundle.js:46)
at Array.webpackJsonpCallback [as push] (runtime.bundle.js:33)
at index-index.bundle.js:1
I've tried to use a lower ts-loader version, including version 5.0.0, version 4.1.0 and version 3.1.1. But it cannot be fixed.
Metadata
Metadata
Assignees
Labels
No labels