Skip to content

scss is not compiled correctly in vue sfc #848

@LateDreamXD

Description

@LateDreamXD

Reproduction link or steps

// package.json
{
  // ...,
  "dependencies": {
    "vue": "^3.5.30"
  },
  "devDependencies": {
    // ...,
    "@tsdown/css": "^0.21.4",
    "sass-embedded": "^1.98.0",
    "tsdown": "^0.21.4",
    "typescript": "^5.9.3",
    "unplugin-vue": "^7.1.1",
    "vue-tsc": "^3.2.6"
  }
}
// tsdown.config.ts
// ...;

export default defineConfig({
	deps: {
		alwaysBundle: ['vue']
	},
	entry: { content: 'src/content/index.ts' },
	plugins: [vue()],
	css: {
		fileName: 'content.css',
		target: 'chrome140'
	},
	platform: 'browser',
	minify: true,
	format: 'iife',
	tsconfig: 'tsconfig.app.json'
});

// src/content/index.ts
import { createApp } from 'vue';
import App from './App.vue';

createApp(App).mount('#app');
<!-- src/content/App.vue -->
<template><!-- ... --></template>

<style lang="scss" scoped>
@mixin shared {
  // shared
}
.el1 {
  @include shared;
  // el1
}
.el2 {
  @include shared;
  // el2
}
</style>

What is expected?

/** dist/content.css */
.el1 {
  /** shared */
  /** el1 */
}

.el2 {
  /** shared */
  /** el2 */
}

What is actually happening?

/** dist/content.css */
@mixin shared {
  /** shared */
}

@include shared;
@include shared;

Any additional comments?

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    Priority

    None yet

    Effort

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions