flyerzrule
flyerzrule2mo ago

Default imports not working

I have an import like this:
import Stumper from "stumper";
import Stumper from "stumper";
I can't call any of the methods that exist on the default export. The Stumper object contains all of the exports from the entire library. I have the ability to use Stumper.default but I feel like that should not be necessary.
1 Reply
bartlomieju
bartlomieju2mo ago
It works exactly the same in Node, it's not a Deno bug
node main.mjs
{
TIMEZONE: { '0': 'LOCAL', '1': 'UTC', LOCAL: 0, UTC: 1 },
LOG_LEVEL: {
'0': 'ERROR',
'1': 'WARNING',
'2': 'INFO',
'3': 'ALL',
ERROR: 0,
WARNING: 1,
INFO: 2,
ALL: 3
},
default: [class Stumper] {
defaultUseColors: true,
defaultUseTimestamp: true,
defaultTimezone: 0,
defaultLogLevel: 0,
useColors: true,
useTimestamp: true,
timezone: 0,
logLevel: 0
}
}
node main.mjs
{
TIMEZONE: { '0': 'LOCAL', '1': 'UTC', LOCAL: 0, UTC: 1 },
LOG_LEVEL: {
'0': 'ERROR',
'1': 'WARNING',
'2': 'INFO',
'3': 'ALL',
ERROR: 0,
WARNING: 1,
INFO: 2,
ALL: 3
},
default: [class Stumper] {
defaultUseColors: true,
defaultUseTimestamp: true,
defaultTimezone: 0,
defaultLogLevel: 0,
useColors: true,
useTimestamp: true,
timezone: 0,
logLevel: 0
}
}
deno main.mjs
{
TIMEZONE: { "0": "LOCAL", "1": "UTC", LOCAL: 0, UTC: 1 },
LOG_LEVEL: {
"0": "ERROR",
"1": "WARNING",
"2": "INFO",
"3": "ALL",
ERROR: 0,
WARNING: 1,
INFO: 2,
ALL: 3
},
default: [class Stumper] {
defaultUseColors: true,
defaultUseTimestamp: true,
defaultTimezone: 0,
defaultLogLevel: 0,
useColors: true,
useTimestamp: true,
timezone: 0,
logLevel: 0
}
}
deno main.mjs
{
TIMEZONE: { "0": "LOCAL", "1": "UTC", LOCAL: 0, UTC: 1 },
LOG_LEVEL: {
"0": "ERROR",
"1": "WARNING",
"2": "INFO",
"3": "ALL",
ERROR: 0,
WARNING: 1,
INFO: 2,
ALL: 3
},
default: [class Stumper] {
defaultUseColors: true,
defaultUseTimestamp: true,
defaultTimezone: 0,
defaultLogLevel: 0,
useColors: true,
useTimestamp: true,
timezone: 0,
logLevel: 0
}
}

Did you find this page helpful?