-
Notifications
You must be signed in to change notification settings - Fork 30.2k
Description
What version of Next.js are you using?
11.0.1
What version of Node.js are you using?
16.3.0
What browser are you using?
Chrome
What operating system are you using?
Windows
How are you deploying your application?
next export
Describe the Bug
I have a post-script for Next.js to generate RSS feed that looks like:
if (!options.dev && options.isServer) {
const originalEntry = config.entry
config.entry = async () => {
const entries = { ...(await originalEntry()) }
entries['./scripts/build-rss'] = './scripts/build-rss.js'
return entries
}
}It gives an error on Next v11.1.0 which uses Webpack v5 underhood saying:
Error: Cannot find module '../../webpack-runtime.js'
It used to work on Webpack v4 (or Next v10) before. Even Tailwind Blog does it that way & it works for them as they are on the old version -> https://github.com/tailwindlabs/blog.tailwindcss.com/blob/master/next.config.js#L85-L93
Expected Behavior
It should work on Next v11.1.0
To Reproduce
See the main branch to see it not working on Next v11 which uses Webpack v5 -> https://github.com/deadcoder0904/next-script-rss-error/tree/main
See the old-version branch to see it working on Next v10 which uses Webpack v4 -> https://github.com/deadcoder0904/next-script-rss-error/tree/old-version
Install the dependencies & make sure perfect dependencies are installed, i.e, v11 for main branch & v10 for old-version branch as they change when using git checkout.
And then run npm run build:development which runs next build && npm run export && npm run rss:development