Ask questionsDynamic import with .then() throws Unexpected token Some(Dot)
I am using "@swc/core": "1.0.40", "swc-loader": "0.1.6",
My input looks like this
componentDidMount() {
const filePath = "../foo/bar"
import(filePath)
.then(bar => {
// bar should be {default: DEFAULT_EXPORTED_THING_IN_BAR} or atleast what it is supposed to be
})
}
The error I get is
error: Unexpected token Some(Dot)
--> /path/to/foo/bar:59:9
|
59 | .then(bar => {
| ^
my .swcrc
does contain dynamic import set as true
"jsc": {
"parser": {
"syntax": "ecmascript",
"jsx": true,
"dynamicImport": true,
"classPrivateProperty": true,
"classProperty": true,
"functionBind": true,
}
}
Is this a bug or am I missing some configuration thing? Thank you
Answer
questions
Pkoiralap
@kdy1 no that is not it! It does not work even with quotes. I forgot to add quotes in the issue. It is in the code. I am updating the issue, please look