-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
Invalid CSS asset filenames generated, breaks site operation #8274
Description
Versions
- nuxt: 2.14.17
- node: 10.15.3
Reproduction
https://github.com/IlyaSemenov/nuxt-css-invalid-filename-reproduction
Steps to reproduce
Using Node 10.15.3 and yarn 1.22.5:
yarn
yarn nuxt build
(See README in the reproduction repo.)
What is Expected?
Build completes successfully. All generated filenames are valid.
What is actually happening?
Build completes successfully, however one of the filenames is invalid: pages/123456789_123456789_123456789_123456789_/pages/test1/test/pages/test2/pages/test2/index/pages//6c0ffc7c.c67c3ba.css. Note the double slash near the end (pages//6c0ffc7c.c67c3ba.css).
This invalid filename goes to the manifest. When these static assets are deployed onto certain CDNs (such as Amazon S3 compatible storages), they wouldn't load, for example:
schools//8be984b7.6b1ee97.css -> 403 Access Denied
schools/8be984b7.6b1ee97.css -> 200 OK
Moreover, this broken chunk completely breaks <nuxt-link>'s pointing to the affected page! (Not included in the minimal reproduction, although it's not hard to add.)
Additional context
This is a regression introduced with #7463 where the css/images/video URLs were changed to include [name].
Also, the documentation misleadingly lists the old defaults:
css: ({ isDev }) => isDev ? '[name].css' : '[contenthash].css'
which is not true anymore.