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

bug: fix the param 'file' might be undefined #11160

Closed
wants to merge 1 commit into from
Closed

bug: fix the param 'file' might be undefined #11160

wants to merge 1 commit into from

Conversation

LoveofRedMoon
Copy link
Contributor

@LoveofRedMoon LoveofRedMoon commented Feb 28, 2020

What kind of change does this PR introduce? (check at least one)

  • Bugfix
  • Feature
  • Code style update
  • Refactor
  • Build-related changes
  • Other, please describe:

Does this PR introduce a breaking change? (check one)

  • Yes
  • No

If yes, please describe the impact and migration path for existing applications:

The PR fulfills these requirements:

If adding a new feature, the PR's description includes:

  • A convincing reason for adding this feature (to avoid wasting your time, it's best to open a suggestion issue first and wait for approval before working on it)

Other information:

When using ssr, some error might happen => 'Cannot read property 'replace' of undefined'
The reason is the vue-ssr-client-manifest.json -> modules[i] might contains -1
this cause the file mapper have undefined in an array.

@posva posva changed the base branch from feat-ssrPrefetch to dev February 28, 2020 09:11
@posva
Copy link
Member

posva commented Feb 28, 2020

Can you provide a boiled down reproduction of the problem?

@danielsuguimoto
Copy link
Contributor

Coding a test case could help understand the issue as well

@LoveofRedMoon
Copy link
Contributor Author

LoveofRedMoon commented Mar 2, 2020 via email

@johnleider
Copy link
Contributor

I'm running into this in the new docs ssg generation.

This is from the client manifest:
image

Since -1 is not a valid index, the result is returned as undefined when mapping:

image

image

@@ -8848,7 +8848,7 @@ function mapIdToFile (id, clientManifest) {
fileIndices.forEach(function (index) {
var file = clientManifest.all[index];
// only include async files or non-js, non-css assets
if (clientManifest.async.indexOf(file) > -1 || !(/\.(js|css)($|\?)/.test(file))) {
if (clientManifest.async.indexOf(file) > -1 || (file && !(/\.(js|css)($|\?)/.test(file)))) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can just drop if there is no file

Suggested change
if (clientManifest.async.indexOf(file) > -1 || (file && !(/\.(js|css)($|\?)/.test(file)))) {
if (file && (clientManifest.async.indexOf(file) > -1 || !(/\.(js|css)($|\?)/.test(file))) {

@posva
Copy link
Member

posva commented Aug 25, 2020

I'm closing in favor of #11609 which is modifying the right file

@posva posva closed this Aug 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants