-
-
Notifications
You must be signed in to change notification settings - Fork 383
Closed
Description
- Operating System: macOS High Sierra 10.13.6
- Node Version: v10.9.0
- NPM Version: 6.4.0
- webpack version: 4.17.1
- webpack-dev-middleware Version: 3.1.3
- This is a feature request
- This is a bug
For Bugs; How can we reproduce the behavior?
There are several bug reports in vue-cli repository related to this bug:
- BaseURI decoding problem when running serve vuejs/vue-cli#2342
- Nested template literals error vuejs/vue-cli#2345
- URIError: Failed to decode param '/%3C%=%20BASE_URL%20%%3Efavicon.ico' vuejs/vue-cli#2357
To reproduce it, run the following commands:
mkdir "#leadinghash"
cd "#leadinghash"
npx @vue/cli create app --default
cd app
npm run serve -- --open
Expected Behavior
A hello world page.
Actual Behavior
A blank page with following error message logged in terminal:
URIError: Failed to decode param '/%3C%=%20BASE_URL%20%%3Efavicon.ico'
Root Cause
It is actually a bug of url-join
(used in middleware.js & util.js):
jfromaniello/url-join#10
require('url-join').('/some/path/with/a/leading/#hash', 'index.html')
// returns '/some/path/with/a/leading#hash/index.html', the `/` before `#` is missing
But I think it is better to solve this issue here because:
- Maintainers of
url-join
does not seem to have a strong willingness to fix this long-standing issue; - Since
url-join
is only used to join filesystem paths inwebpack-dev-middleware
,path.posix,join
could be a sufficient replacement.