Including exclamation mark(" ! ") in assetPrefix compilation will result in an error
Open
Nobody has claimed this yet.
bug
create-next-app
- Dominant language
- JavaScript
- Stars
- 142k
- Forks
- 32.4k
- Avg merge
- 2d 14h
- Merged PRs (30d)
- 351
Description
Link to the code that reproduces this issue
To Reproduce
Add the following config to "next.config.mjs":
output: "export",
assetPrefix: "https://mycdn.com/!mark",
if the assetPrefix incude "!" will trigger error
if change the "!" to "21%" will be ok (but not my need)
Current vs. Expected behavior
Current:
➜ workspace git:(master) ✗ yarn build
yarn run v1.22.19
$ next build
▲ Next.js 15.0.0-canary.196
Creating an optimized production build ...
Failed to compile.
Module not found: Error: Can't resolve 'mark&nextConfigOutput=export&flyingShuttle=false&nextConfigExperimentalUseEarlyImport=&preferredRegion=&middlewareConfig=e30%3D' in '/project/workspace'
Module not found: Error: Can't resolve 'mark&nextConfigOutput=export&flyingShuttle=false&nextConfigExperimentalUseEarlyImport=&preferredRegion=&middlewareConfig=e30%3D' in '/project/workspace'
Module not found: Error: Can't resolve 'mark&nextConfigOutput=export&flyingShuttle=false&nextConfigExperimentalUseEarlyImport=&preferredRegion=&middlewareConfig=e30%3D' in '/project/workspace'
> Build failed because of webpack errors
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Provide environment information
Operating System:
Platform: linux
Arch: x64
Version: #1 SMP PREEMPT_DYNAMIC Sun Aug 6 20:05:33 UTC 2023
Available memory (MB): 4102
Available CPU cores: 2
Binaries:
Node: 20.9.0
npm: 9.8.1
Yarn: 1.22.19
pnpm: 8.10.2
Relevant Packages:
next: 15.0.0-canary.196 // Latest available version is detected (15.0.0-canary.196).
eslint-config-next: N/A
react: 19.0.0-rc-77b637d6-20241016
react-dom: 19.0.0-rc-77b637d6-20241016
typescript: 5.3.3
Next.js Config:
output: export
Which area(s) are affected? (Select all that apply)
create-next-app
Which stage(s) are affected? (Select all that apply)
next build (local)
Additional context
Both 15.0 and 14.x is not ok
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the failure with the assetPrefix in next.config.mjs and run next build using the linked CodeSandbox setup. Compare it with the working percent-encoded value, then trace how the assetPrefix is handled during the build; done means an exclamation mark no longer produces the reported module-resolution error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, nextjs
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100