Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(compiler-sfc): error generating CSS sourcemap when using SCSS #9970

Closed
wants to merge 4 commits into from
Closed
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
1 change: 1 addition & 0 deletions packages/compiler-sfc/src/compileTemplate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@ function doCompileTemplate({
// We need to parse a fresh one. Can't just use `source` here since we need
// the AST location info to be relative to the entire SFC.
const newAST = (ssr ? CompilerDOM : compiler).parse(inAST.source, {
...compilerOptions,
parseMode: 'sfc',
onError: e => errors.push(e),
})
Expand Down
2 changes: 1 addition & 1 deletion packages/compiler-sfc/src/style/preprocessors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ const scss: StylePreprocessor = (source, map, options, load = require) => {
code: result.css.toString(),
map: merge(
map,
result.map.toJSON
!(result.map instanceof Buffer) && result.map.toJSON
? result.map.toJSON()
: JSON.parse(result.map.toString()),
),
Expand Down
10 changes: 8 additions & 2 deletions packages/sfc-playground/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ const sfcOptions: SFCOptions = {
template: {
isProd: useProdMode.value,
compilerOptions: {
isCustomElement: (tag: string) => tag === 'mjx-container'
}
isCustomElement: (tag: string) => tag === 'mjx-container',
},
},
}

Expand Down Expand Up @@ -137,6 +137,12 @@ onMounted(() => {
:autoResize="true"
:sfcOptions="sfcOptions"
:clearConsole="false"
:preview-options="{
customCode: {
importCode: `import { initCustomFormatter } from 'vue'`,
useCode: `initCustomFormatter()`,
},
}"
/>
</template>

Expand Down