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

vuepress build with --debug flag breaks doc search #1944

Open
1 task done
favoyang opened this issue Oct 12, 2019 · 7 comments
Open
1 task done

vuepress build with --debug flag breaks doc search #1944

favoyang opened this issue Oct 12, 2019 · 7 comments
Labels
topic: config Relates to VuePress config type: bug Something isn't working

Comments

@favoyang
Copy link
Contributor

  • I confirm that this is an issue rather than a question.

Bug report

vuepress build with "--debug" flag breaks doc search, and perhaps other features.

Steps to reproduce

  1. create a project with docs folder.
  2. yarn add -D vuepress serve
  3. add a few random markdown files into the docs folder.
  4. vuepress build docs && serve docs/.vuepress/dist works.
  5. vuepress build docs --debug && serve docs/.vuepress/dist. then try doc search function, type anything without response.

What is expected?

It shall work with or without --debug flag

What is actually happening?

Not only doc search failed, the vue devtools can not detect vue on the page.

Other relevant information

  • Output of npx vuepress info in my VuePress project:
$ npx vuepress info                                               
                                                                  
Environment Info:                                                 
                                                                  
  System:                                                         
    OS: Windows 10                                                
    CPU: (8) x64 Intel(R) Core(TM) i7-2635QM CPU @ 2.00GHz        
  Binaries:                                                       
    Node: 10.16.2 - C:\Program Files\nodejs\node.EXE              
    Yarn: 1.19.0 - C:\Program Files (x86)\Yarn\bin\yarn.CMD       
    npm: 6.10.3 - C:\Program Files\nodejs\npm.CMD                 
  Browsers:                                                       
    Edge: 44.18362.387.0                                          
  npmPackages:                                                    
    @vuepress/core: Not Found                                     
    @vuepress/theme-default: Not Found                            
    vuepress: ^1.2.0 => 1.2.0                                     
  npmGlobalPackages:                                              
    vuepress: Not Found                                           
@haoranpb
Copy link
Contributor

haoranpb commented Oct 13, 2019

Build with --debug will also keep menus in the sidebar from expanding, see #1913

@kefranabg kefranabg added type: bug Something isn't working topic: config Relates to VuePress config labels Oct 14, 2019
@tskrynnyk
Copy link

Build without --debug flag gives the same effect on the phone - sidebar not expand and search form not search.

@ptandler
Copy link

I also stepped over the issue (with VuePress cli.js/1.2.0 win32-x64 node-v12.13.0) that using --debug with build creates a site that is not fully functional.

@tskrynnyk For me it does work without "--debug".

I did notice that no mounted hooks are called, see my stackoverflow question. The --debug option works fine with dev.
This causes that no event listeners are attached, breaking a lot of stuff.

If you read the VuePress CLI documentation carefully, you might notice that this option is intended for development server only.

However, I would expect that

  • at least a warning is issued,
  • the option is ignored with "build" or
  • the option is used to log some more debug information but build the site in the same way as without "--debug" (That was what I did expect).

I created a tiny VuePress project for me to reproduce the error while I was debugging.

@haoranpb
Copy link
Contributor

@ptandler Nice Catch! Never notice that 👍

@ptandler
Copy link

Oh, well, it took me quite a while to figure out what was wrong with my build ;-)

@haoranpb
Copy link
Contributor

haoranpb commented Mar 7, 2020

I made some tests. Change this line

into

if (env.isDebug && !isProd) {

seems to solve the problem.

@thekiwi
Copy link

thekiwi commented Nov 5, 2020

This also caught me out when using the mermaidjs plugin - it would definitely be good to see either a fix or some sort of warnings like ptandler suggested!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: config Relates to VuePress config type: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

6 participants