Skip to content
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

ReferenceError: self is not defined #59

Open
jeanbenoit-richez opened this issue Mar 8, 2024 · 1 comment
Open

ReferenceError: self is not defined #59

jeanbenoit-richez opened this issue Mar 8, 2024 · 1 comment

Comments

@jeanbenoit-richez
Copy link

Hi,
The bundling is going good, i got my three: cjs, umd and esm bundle's file.
But when i'm trying to load my app with next.js I got this error:
"ReferenceError: self is not defined".

Next.js seems to load the common-js package on server.
The error is coming from the way webpack is loaded in the bundle itself:
Capture d’écran 2024-03-08 à 17 20 38

I tried everything available online.
Adding:

new webpack.ProvidePlugin({
      self: 'self',
}),

But still not working...
Do you think the problem is coming from webpack directly or from the way you used it in the library ?
Thank you.

@jeanbenoit-richez
Copy link
Author

adding in my webpack.config.js:

globalObject: 'this',

Works :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant