Skip to content

Sourcemap is not being output correctly #7

@fablrdigital

Description

@fablrdigital

I am using this plugin to generate sourcemaps for our CSS output but all it is outputting is the following.

{"version":3,"file":null,"sources":[],"sourcesContent":[],"names":[],"mappings":""}

Here is an example of our vite.config.js

import { defineConfig } from "vite";
import cssSourcemap from 'vite-plugin-css-sourcemap';

export default defineConfig({
  plugins: [cssSourcemap({
    enabled: true,
    extensions: ['.scss', '.css'],
  })],
  build: {
    cssMinify: true,
    rollupOptions: {
      input: "assets/scss/main.scss",
      output: {
        assetFileNames: `[name].[ext]`,
      },
    },
  },
});

CSS is generated fine but mapping is not generated. Below is our package.json FYI.

{
  "name": "sample",
  "private": true,
  "version": "0.0.Z",
  "type": "module",
  "scripts": {
    "dev": "vite",
    "build": "vite build",
    "build:watch": "vite build --watch",
    "preview": "vite preview"
  },
  "devDependencies": {
    "sass": "^1.89.2",
    "vite": "^6.3.5",
    "vite-plugin-css-sourcemap": "^1.0.2"
  },
  "dependencies": {
  }
}

Hope someone can help or advise what might be happening here. I tried everything described in #3 and it didn't help.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions