language-javascript
language-javascript copied to clipboard
import() function is not allowed (The module could not be parsed: ImportToken)
when import webpack function is used
exports.lazyLoadedImport = function() {
var x = import(
'./Example.Lazy.LazyLoaded.purs'
)
console.log(x)
return x
}
it throws error -
Unable to parse foreign module:
examples/lazy/src/LazyLoadedImport.js
The module could not be parsed:
ImportToken {tokenSpan = TokenPn 50 2 11, tokenLiteral = "import", tokenComment = [WhiteSpace (TokenPn 49 2 10) " "]}
Expected
import() function should not be parsed as import token
@erikd could you suggest how to approach this issue, I would like to make pr
I think this is related to https://github.com/erikd/language-javascript/issues/115
For me the best thing would be to just treat it as a global function. My JS bundler then takes care of resolving it.