Skip to content

Sourcemap is only generated for the entrypoint scss #13

@thany

Description

@thany

I have to import styles like this in my vite config:

export default defineConfig({
    build: {
        rollupOptions: {
            input: {
                main: 'javascript/main.js',
                styles: 'styles/main.scss',
    // ...

Because this is a traditional project where the server renders the HTML, and Vite just needs to output a specific set of files that are referenced in the HTML. The styles key is the Scss entrypoint, and points to a file that just does an @import of a bunch of other files.

Generating a sourcemap works. It's not named styles.css.map but main.css.map and it also doesn't go into the correct folder by default (I would expect it to be sat next to the output css), but that's fine for now. Those are not insurmountable obstacles, it seems.

What's blocking me is that the sourcemaps only cover the entrypoint file, and nothing beyond it. It's like imports are just simply not processed while generating sourcemaps.

However, I admit I'm on Vite 7.3.1 which is not supported. I'm not sure if this problem would exist with Vite 6 as well. It's also entirely possible that this plugin just simply doesn't correctly support adding Scss as an entrypoint into the rollupOptions 🤷🏻‍♂️

Vite for some reason doesn't want to do it natevely. Wouldn't expect that in a modern build tool, but whatever. So my hope is currently on this plugin. 😖🙏🏻

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