-
Notifications
You must be signed in to change notification settings - Fork 273
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
ES modules not working with Next.js #1188
Comments
Internal Ref: OKTA-491223 |
Hi All, I'm having the same issue. Any fix or workaround by any chance? |
@HugoP27 Yeah, you can import using const {OktaAuth, toRelativeUrl} = require('@okta/okta-auth-js') |
Reason for error: Solutions:
Wokaround for 2 can be one of follows:
experimental: { esmExternals: false },
const nextConfig = {
...
};
const withTM = require('next-transpile-modules')([
'@okta/okta-auth-js',
'broadcast-channel'
]);
module.exports = withTM(nextConfig); |
Please upgrade to 6.6.1 to fix the issue without workarounds |
Now is working as expected on version |
Describe the bug?
Using ES Module like stated in documentation:
Results in the following error:
What is expected to happen?
The application runs properly.
What is the actual behavior?
The application breaks.
Reproduction Steps?
SDK Versions
@okta/okta-auth-js: "^6.4.3"
Execution Environment
Node: 16.14.2
Additional Information?
Application runs correctly if importing with require and Common Js.
The text was updated successfully, but these errors were encountered: