Skip to content

Commit

Permalink
fix: fix inconsistent path between Windows and POSIX systems (‏ (#1384
Browse files Browse the repository at this point in the history
* Fix inconsistent path between Windows and POSIX systems

* Fix test
  • Loading branch information
sharkykh authored and yyx990803 committed Aug 18, 2018
1 parent 0c2da0f commit 74a7dbd
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ var component = normalizer(
? JSON.stringify(filename)
// Expose the file's full path in development, so that it can be opened
// from the devtools.
: JSON.stringify(rawShortFilePath)
: JSON.stringify(rawShortFilePath.replace(/\\/g, '/'))
}`

code += `\nexport default component.exports`
Expand Down
3 changes: 1 addition & 2 deletions test/advanced.spec.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
const path = require('path')
const { SourceMapConsumer } = require('source-map')
const normalizeNewline = require('normalize-newline')
const MiniCssExtractPlugin = require('mini-css-extract-plugin')
Expand Down Expand Up @@ -50,7 +49,7 @@ test('expose file path as __file outside production', done => {
mockBundleAndRun({
entry: 'basic.vue'
}, ({ module }) => {
expect(module.__file).toBe(path.normalize('test/fixtures/basic.vue'))
expect(module.__file).toBe('test/fixtures/basic.vue')
done()
})
})
Expand Down

0 comments on commit 74a7dbd

Please sign in to comment.