Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

_plugin-vue_export-helper js file cant not be access with Github Pages(404) #9119

Closed
7 tasks done
cloudhao1999 opened this issue Jul 14, 2022 · 6 comments
Closed
7 tasks done

Comments

@cloudhao1999
Copy link

Describe the bug

@vitejs/plugin-vue3.0.0 change the name of the export file, that adds the _,
image
that made the website built with Github Pages can not access because The Github Pages block the file starting with the underline character, Though it can be resolved to add the .nojekyll file at the root space, it just not a good solution, I add the .nojekyll file in my project, so the Reproduction link maybe not find the error. If the file is removed, it'll make a 404 error.

Reproduction

https://cloudhao1999.github.io/cloud-app-admin

System Info

System:
    OS: macOS 12.4
    CPU: (8) arm64 Apple M1
    Memory: 113.98 MB / 16.00 GB
    Shell: 5.8.1 - /bin/zsh
  Binaries:
    Node: 16.14.0 - ~/.nvm/versions/node/v16.14.0/bin/node
    Yarn: 1.22.19 - ~/.nvm/versions/node/v16.14.0/bin/yarn
    npm: 8.13.2 - ~/.nvm/versions/node/v16.14.0/bin/npm
    Watchman: 2022.02.07.00 - /opt/homebrew/bin/watchman
  Browsers:
    Firefox: 102.0.1
    Safari: 15.5

Used Package Manager

pnpm

Logs

No response

Validations

@bluwy
Copy link
Member

bluwy commented Jul 14, 2022

It seems like you configured manualChunks which might've caused that file to be generated (though looking at the code in technically shouldn't). Does removing that fix it for you?

I tried reproducing the manualChunks in the Vite vue template and it seems to be fine. This is likely caused by #8792, though we're doing that as a virtual id only.

@cloudhao1999
Copy link
Author

It seems like you configured manualChunks which might've caused that file to be generated (though looking at the code in technically shouldn't). Does removing that fix it for you?

I tried reproducing the manualChunks in the Vite vue template and it seems to be fine. This is likely caused by #8792, though we're doing that as a virtual id only.

I tried to reinstall the node_modules and remove the manualChunks option, and the file also generated😂, Maybe some plugin caused.

@sapphi-red
Copy link
Member

When \0plugin-vue:export-helper is extracted as a chunk, \0 will be replaced with _ by sanitizeFileName.
We could use output.sanitizeFileName to change the behavior.

One way to solve this is to change Vite's default output.sanitizeFileName. But maybe we should just update the docs to make the difference between rollup less.

@patak-dev
Copy link
Member

We should check when is this helper being extracted as a chunk, that sounds quite inefficient to have as a separate file.

@sapphi-red
Copy link
Member

Sorry that I misled you. The extracted chunk also includes vue (as far as I could imagine).

Here is a example (stackblitz).
The dependency graph is:

                          ↙ vue 
main.js ← HelloWorld.vue ← export-helper
        ↖ vue
                          ↙ vue 
sub.js ← HelloWorld2.vue ← export-helper
       ↖ vue 

So it is bundled as

main.hash.js: main.js, HelloWorld.vue
sub.hash.js: sub.js, HelloWorld2.vue
_plugin-vue_export-helper.hash.js: export-helper, vue

@cloudhao1999
Copy link
Author

When \0plugin-vue:export-helper is extracted as a chunk, \0 will be replaced with _ by sanitizeFileName. We could use output.sanitizeFileName to change the behavior.

One way to solve this is to change Vite's default output.sanitizeFileName. But maybe we should just update the docs to make the difference between rollup less.

Thanks! According to your suggestion, I rewrote the method and the problem was solved.

@github-actions github-actions bot locked and limited conversation to collaborators Aug 4, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants