Skip to content
This repository has been archived by the owner on Aug 16, 2022. It is now read-only.

fix: normalize source map file path on windows #83

Merged
merged 2 commits into from
Feb 1, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"rollup-plugin-image": "^1.0.2",
"rollup-plugin-node-resolve": "^3.3.0",
"ts-jest": "^22.4.2",
"typescript": "^2.7.2",
"typescript": "^3.2.4",
"typescript-eslint-parser": "^15.0.0",
"vue": "^2.5.16",
"vue-template-compiler": "^2.5.16"
Expand All @@ -57,7 +57,7 @@
"vue-template-compiler": "*"
},
"dependencies": {
"@vue/component-compiler-utils": "^2.1.0",
"@vue/component-compiler-utils": "^2.5.2",
"clean-css": "^4.1.11",
"hash-sum": "^1.0.2",
"postcss-modules-sync": "^1.0.0",
Expand Down
2 changes: 1 addition & 1 deletion src/assembler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export function assembleFromSource(
script = script || { source: 'export default {}' }
template = template || { source: '' }
let map = undefined
const mapGenerator = new SourceMapGenerator({ file: filename })
const mapGenerator = new SourceMapGenerator({ file: filename.replace(/\\/g, '/') })

const hasScopedStyle = styles.some(style => style.scoped === true)
const hasStyle = styles.some(style => style.source || style.module)
Expand Down
40 changes: 23 additions & 17 deletions src/compiler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,20 +99,23 @@ export class SFCCompiler {
? hash(path.basename(filename) + source)
: hash(filename + source))

const template =
descriptor.template && this.compileTemplate(filename, descriptor.template)
const template = descriptor.template
? this.compileTemplate(filename, descriptor.template)
: undefined

const styles = descriptor.styles.map(style =>
this.compileStyle(filename, scopeId, style)
)

const { script: rawScript, customBlocks } = descriptor
const script = rawScript && {
code: rawScript.src
? this.read(rawScript.src, filename)
: rawScript.content,
map: rawScript.map
}
const script = rawScript
? {
code: rawScript.src
? this.read(rawScript.src, filename)
: rawScript.content,
map: rawScript.map
}
: undefined

return {
scopeId,
Expand Down Expand Up @@ -140,8 +143,9 @@ export class SFCCompiler {
? hash(path.basename(filename) + source)
: hash(filename + source))

const template =
descriptor.template && this.compileTemplate(filename, descriptor.template)
const template = descriptor.template
? this.compileTemplate(filename, descriptor.template)
: undefined

const styles = await Promise.all(
descriptor.styles.map(style =>
Expand All @@ -150,12 +154,14 @@ export class SFCCompiler {
)

const { script: rawScript, customBlocks } = descriptor
const script = rawScript && {
code: rawScript.src
? this.read(rawScript.src, filename)
: rawScript.content,
map: rawScript.map
}
const script = rawScript
? {
code: rawScript.src
? this.read(rawScript.src, filename)
: rawScript.content,
map: rawScript.map
}
: undefined

return {
scopeId,
Expand Down Expand Up @@ -260,7 +266,7 @@ export class SFCCompiler {
},

prepare: result => ({
media: style.attrs.media,
media: typeof style.attrs.media === 'string' ? style.attrs.media : undefined,
scoped: style.scoped,
moduleName: style.module === true ? '$style' : <any>style.module,
module: tokens,
Expand Down
Loading