vuepress build with `--debug` flag breaks doc search

Created on 12 Oct 2019  路  7Comments  路  Source: vuejs/vuepress




  • [x] 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                                           
config bug

Most helpful comment

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.

All 7 comments

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

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

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.

@ptandler Nice Catch! Never notice that 馃憤

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

I made some tests. Change this line
https://github.com/vuejs/vuepress/blob/4c6fbcc5736c72f32e4a8208d5cfa46d86b2bf22/packages/%40vuepress/core/lib/node/webpack/createBaseConfig.js#L46

into

if (env.isDebug && !isProd) {

seems to solve the problem.

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!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

harryhorton picture harryhorton  路  3Comments

kid1412621 picture kid1412621  路  3Comments

FadySamirSadek picture FadySamirSadek  路  3Comments

herrbischoff picture herrbischoff  路  3Comments

cfjedimaster picture cfjedimaster  路  3Comments