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

Nextjs 15 | ReferenceError: self is not defined #503

Open
ruizehung opened this issue Nov 13, 2024 · 3 comments
Open

Nextjs 15 | ReferenceError: self is not defined #503

ruizehung opened this issue Nov 13, 2024 · 3 comments

Comments

@ruizehung
Copy link

Summary

Nextjs 15 | ReferenceError: self is not defined

Steps to Reproduce

I create a next js 15 app using https://create.t3.gg/. And then I install Preline following https://preline.co/docs/frameworks-nextjs.html. Then next dev error out with ReferenceError: self is not defined.

Steps to reproduce:

  1. Clone https://github.com/ruizehung/debug-turbo
  2. Run pnpm i
  3. Runpnpm run dev
  4. See error

Demo Link

https://github.com/ruizehung/debug-turbo

Expected Behavior

Preline should work with Nextjs 15 created from T3 stack

Actual Behavior

Full log:

debug-turbo git:(main) ✗ pnpm run dev                                                      

> [email protected] dev /Users/rayhung/Dev/debug-turbo
> next dev

 ⚠ Port 3000 is in use, trying 3001 instead.
   ▲ Next.js 15.0.3
   - Local:        http://localhost:3001
   - Environments: .env

 ✓ Starting...
 ✓ Ready in 1041ms
 ○ Compiling / ...
 ⨯ ./src/styles/globals.css.webpack[javascript/auto]!=!./node_modules/.pnpm/[email protected][email protected][email protected][email protected]/node_modules/next/dist/build/webpack/loaders/css-loader/src/index.js??ruleSet[1].rules[13].oneOf[10].use[2]!./node_modules/.pnpm/[email protected][email protected][email protected][email protected]/node_modules/next/dist/build/webpack/loaders/postcss-loader/src/index.js??ruleSet[1].rules[13].oneOf[10].use[3]!./src/styles/globals.css
ReferenceError: self is not defined
Import trace for requested module:
./src/styles/globals.css.webpack[javascript/auto]!=!./node_modules/.pnpm/[email protected][email protected][email protected][email protected]/node_modules/next/dist/build/webpack/loaders/css-loader/src/index.js??ruleSet[1].rules[13].oneOf[10].use[2]!./node_modules/.pnpm/[email protected][email protected][email protected][email protected]/node_modules/next/dist/build/webpack/loaders/postcss-loader/src/index.js??ruleSet[1].rules[13].oneOf[10].use[3]!./src/styles/globals.css
./src/styles/globals.css
 ⨯ ./src/styles/globals.css.webpack[javascript/auto]!=!./node_modules/.pnpm/[email protected][email protected][email protected][email protected]/node_modules/next/dist/build/webpack/loaders/css-loader/src/index.js??ruleSet[1].rules[13].oneOf[10].use[2]!./node_modules/.pnpm/[email protected][email protected][email protected][email protected]/node_modules/next/dist/build/webpack/loaders/postcss-loader/src/index.js??ruleSet[1].rules[13].oneOf[10].use[3]!./src/styles/globals.css
ReferenceError: self is not defined
Import trace for requested module:
./src/styles/globals.css.webpack[javascript/auto]!=!./node_modules/.pnpm/[email protected][email protected][email protected][email protected]/node_modules/next/dist/build/webpack/loaders/css-loader/src/index.js??ruleSet[1].rules[13].oneOf[10].use[2]!./node_modules/.pnpm/[email protected][email protected][email protected][email protected]/node_modules/next/dist/build/webpack/loaders/postcss-loader/src/index.js??ruleSet[1].rules[13].oneOf[10].use[3]!./src/styles/globals.css
./src/styles/globals.css
 GET / 500 in 1434ms

Screenshots

image
@blaskoj
Copy link

blaskoj commented Nov 29, 2024

I have the same issue ! Did you find a solution for this now ?

@CoOlDud3
Copy link

I was able to make it work locally for now by setting the following in tailwindcss.config.js:

plugins: [import('preline/preline.js')],

And then running the next.js application without --turbopack.

This won't work on Vercel though.

@oliveirasamueldev
Copy link

same issue here

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

4 participants