You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am writing a npm package which will running in node environment. and i find a problem.
if my ts code like:
classTestModule{}exportdefaultTestModule;
this code will transifier to:
// transifier-index.js// some code...export.default=TestModule;
And then if i want to use this package like this:
consttestModule=require('transifier-index.js');console.log(testModule);// { default: [Function: TestModule] }constobj=newtestModule()// error: testModule is not a constructor
but if i write .ts file like this:
classTestModule{}export=TestModule;
then i will get the current module.export:
// transifier-index.js// some code...module.export=TestModule;
Question: what't different between export = xxx and export default xxx? How can i transfer export default xxx to module.export =xxx?
some version info:
node: 7.7.1
webpack: 2.6.1
ts-loader: last version
tsc: 2.4.1
I am writing a npm package which will running in node environment. and i find a problem.
if my
ts
code like:this code will transifier to:
And then if i want to use this package like this:
but if i write
.ts
file like this:then i will get the current
module.export
:Question: what't different between
export = xxx
andexport default xxx
? How can i transferexport default xxx
tomodule.export =xxx
?some version info:
some config:
The text was updated successfully, but these errors were encountered: