Skip to content

[Bug - next-pwa]: __dirname is not defined when using 10.2.0 and nextjs 14 #134

Closed
@arvinxx

Description

@arvinxx

Provide environment information

NextJS: 14.0.4
@DuCanhGH/next-pwa: 10.2.0

Link to reproduction - Issues with a link to complete (but minimal) reproduction code help us address them faster

lobehub/lobe-chat#1011

To reproduce

git clone https://github.com/lobehub/lobe-chat

git checkout arvinxx-patch-1

bun run i

npm run build

Describe the bug

ReferenceError: __dirname is not defined
16:33:20.398 | at createContext (file:///vercel/path0/node_modules/@ducanh2912/next-pwa/dist/index.js:1:15434)
16:33:20.398 | at Object.webpack (file:///vercel/path0/node_modules/@ducanh2912/next-pwa/dist/index.js:2:6271)
16:33:20.398 | at Object.webpack (/vercel/path0/node_modules/@next/bundle-analyzer/index.js:23:29)
16:33:20.398 | at getBaseWebpackConfig (/vercel/path0/node_modules/next/dist/build/webpack-config.js:1738:32)
16:33:20.398 | at async Promise.all (index 1)
16:33:20.398 | at async Span.traceAsyncFn (/vercel/path0/node_modules/next/dist/trace/trace.js:147:20)
16:33:20.398 | at async webpackBuildImpl (/vercel/path0/node_modules/next/dist/build/webpack-build/impl.js:132:21)
16:33:20.398 | at async webpackBuild (/vercel/path0/node_modules/next/dist/build/webpack-build/index.js:165:16)
16:33:20.398 | at async /vercel/path0/node_modules/next/dist/build/index.js:695:115
16:33:20.398 | at async Span.traceAsyncFn (/vercel/path0/node_modules/next/dist/trace/trace.js:147:20)
16:33:20.423 | error: script "build" exited with code 1
16:33:20.427

Expected behavior

build success

Screenshots (if relevant)

image

image

Additional information (if relevant)

No response

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingnext-pwaThis is related to next-pwatriageNew issues get this label, remove it after triage

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions