-
Notifications
You must be signed in to change notification settings - Fork 75
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Attempted import error: 'UserManager' is not exported from 'oidc-client-ts'. #133
Comments
when using "moduleResolution": "node" oidc-client-ts.cjs |
Have you installed oidc-client-ts ? (Which is a peerDependency) |
Yes. |
strange wise webpack (create react app) is mixing module(esm) and main(commonjs), why?
|
The problem seems to be the the https://webpack.js.org/guides/ecma-script-modules/ @kherock |
I can't reproduce this, and the .mjs extension is important for native ESM support from Node. I was actually going to suggest moving to the package What version of Node are you running, and what does your webpack config look like? |
We can change this back + make a fix. I was unable to find another solution yet. We are using react create app (https://www.npmjs.com/package/react-scripts v4.0.3), which is using under the hood webpack v4. Docu: For Node.JS we are using v16. |
Ok, Webpack v4 is really the problem here. I think migrating to "main": "dist/react-oidc-context.cjs",
"types": "dist/react-oidc-context.d.ts"
"exports": {
".": {
"import": "./dist/react-oidc-context.mjs",
"require": "./dist/react-oidc-context.cjs"
},
"./package.json": "./package.json"
}
// ... |
I think this is relevant: |
"main": "dist/react-oidc-context.cjs",
"module": "dist/react-oidc-context.mjs",
"types": "dist/react-oidc-context.d.ts",
"exports": {
".": {
"import": "./dist/react-oidc-context.mjs",
"require": "./dist/react-oidc-context.cjs"
},
"./package.json": "./package.json"
} still leads to this error:
|
"main": "dist/react-oidc-context.cjs",
"types": "dist/react-oidc-context.d.ts",
"exports": {
".": {
"import": "./dist/react-oidc-context.mjs",
"require": "./dist/react-oidc-context.cjs"
},
"./package.json": "./package.json"
} leads to:
|
Ok, I'll see if I can find a happy medium for this issue soon. Dropping the |
I am wondering if it would make sense to wait for react-scripts v5, where they have switched to webpack v5. Within their milestone there is only one issue left. On the other hand we could go now with webapck v4 support and later drop that by using mjs extenstion... |
When using the react-oidc-context library v2.0.0.beta.1 in a project:
./node_modules/react-oidc-context/dist/react-oidc-context.mjs
Attempted import error: 'UserManager' is not exported from 'oidc-client-ts'.
The text was updated successfully, but these errors were encountered: