Skip to content

Source-map issue on windows #47

Closed
@3cp

Description

@3cp

First, mozilla/source-map doesn't support \ as separator at all, because it's designed to be consumed in browser.

mozilla/source-map#91

  1. the file and sourceRoot has to be normalized.
    const map = new SourceMapGenerator({
    file: filename,
    sourceRoot
{
  file: filename.replace(/\\/g, '/'),
  sourceRoot: sourceRoot.replace(/\\/g, '/')
}

There is one more to be fixed in @vue/component-compiler.
https://github.com/vuejs/vue-component-compiler/blob/afa1cd440123e2e0c195908c1e15935273ac64a9/src/assembler.ts#L77

  1. actually the default sourceRoot doesn't make much sense, because when serving the source-map to browser, process.cwd() is irrelevant.
    sourceRoot = process.cwd(),

Change to

sourceRoot = '',

With the above two fixes, it can fix https://travis-ci.org/dumberjs/gulp-vue-file/builds/477568946
Update: I managed to fix the gulp-vue-file bug within gulp-vue-file by rewriting sourcemaps (normalize sources and file path). But the incoming sourcemaps should also be fixed in vue compiler.

Let me know what you think, I can make some PRs for this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions