Skip to content

vuepress build breaks when configureWebpack object contains devtool: 'source-map' #2708

Open
@th0r

Description

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

Bug report

I'm trying to debug production build with the help of sourcemaps but seems like turning them on (setting devtool: 'source-map' in configureWebpack` object) breaks it - scripts doesn't work and build behaves like a set of static HTML pages.

Steps to reproduce

  1. Clone https://github.com/th0r/vuepress-sourcemap-bug
  2. Run npm ci && npm run build && npx http-server src/.vuepress/dist
  3. Open http://127.0.0.1:8080 and ensure that build works:
  • Input a into the search bar and ensure that suggestion popup appears
  • Click Guide link and ensure that search bar still contains a (new page has been loaded dynamically, without full page reload)
  1. Run SOURCEMAPS=true npm run build && npx http-server src/.vuepress/dist. SOURCEMAPS=true env variable sets devtool webpack option to source-map (see src/.vuepress/config.js).
  2. Open http://127.0.0.1:8080 and ensure that JS bundle is not cached (check Disable cache in browsers dev tools and reload the page)
  3. Build is broken:
  • Input a into the search bar - suggestion popup doesn't appear
  • Click Guide link - search bar becomes empty which means full page reload happened.

What is expected?

See "Steps to reproduce"

What is actually happening?

See "Steps to reproduce"

Other relevant information

  • Output of npx vuepress info in my VuePress project:
  System:
    OS: macOS 10.15.7
    CPU: (16) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
  Binaries:
    Node: 12.19.1 - ~/.nvm/versions/node/v12.19.1/bin/node
    Yarn: Not Found
    npm: 6.14.8 - ~/.nvm/versions/node/v12.19.1/bin/npm
  Browsers:
    Chrome: 86.0.4240.198
    Edge: Not Found
    Firefox: 81.0.2
    Safari: 14.0
  npmPackages:
    @vuepress/core:  1.7.1
    @vuepress/theme-default:  1.7.1
    vuepress: ^1.5.3 => 1.7.1
  npmGlobalPackages:
    vuepress: Not Found

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions