Error importing .mjs in Angular (Typescript)
See original GitHub issueHi Ceci!
I was looking at what it would take to migrate from 2.x to 3.0. In a simple Angular 9 app, I’m getting compile errors trying to import these new modules. I don’t think Typescript likes these .mjs files. I can get past the errors by directly importing the .js file in the package dist directory.
ps - Did you remove the generated api docs? Links here go to broken pages. https://salte-auth.github.io/
Description
In a simple Angular 9 app, import { Redirect } from '@salte-auth/redirect'; yields the following error
ERROR in ./node_modules/@salte-auth/redirect/dist/redirect.mjs 40:19-24 Can’t import the named export ‘Utils’ from non EcmaScript module (only default export is available)
No compile errors with an import like this:
import { Redirect } from '@salte-auth/redirect/dist/redirect.js';
Expected outcome
No compile errors starting angular app
Actual outcome

Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:7 (5 by maintainers)
Top Related StackOverflow Question
@cecilia-sanare yes, the latest update is importing the
*.min.jsnow and I’m no longer getting those import errors.@pherrmann Sorry it took so long, had a couple of issues I needed to resolve with the automated release process.
Can you try it out now with the latest versions of
@salte-auth/salte-auth,@salte-auth/wso2, and@salte-auth/redirect?