Skip to content

Commit 74a7dbd

Browse files
sharkykhyyx990803
authored andcommitted
fix: fix inconsistent path between Windows and POSIX systems (‏ (#1384
* Fix inconsistent path between Windows and POSIX systems * Fix test
1 parent 0c2da0f commit 74a7dbd

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

Diff for: lib/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ var component = normalizer(
177177
? JSON.stringify(filename)
178178
// Expose the file's full path in development, so that it can be opened
179179
// from the devtools.
180-
: JSON.stringify(rawShortFilePath)
180+
: JSON.stringify(rawShortFilePath.replace(/\\/g, '/'))
181181
}`
182182

183183
code += `\nexport default component.exports`

Diff for: test/advanced.spec.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
const path = require('path')
21
const { SourceMapConsumer } = require('source-map')
32
const normalizeNewline = require('normalize-newline')
43
const MiniCssExtractPlugin = require('mini-css-extract-plugin')
@@ -50,7 +49,7 @@ test('expose file path as __file outside production', done => {
5049
mockBundleAndRun({
5150
entry: 'basic.vue'
5251
}, ({ module }) => {
53-
expect(module.__file).toBe(path.normalize('test/fixtures/basic.vue'))
52+
expect(module.__file).toBe('test/fixtures/basic.vue')
5453
done()
5554
})
5655
})

0 commit comments

Comments
 (0)