Skip to content

Consider TS path aliases for Sass #98

Closed
@jens-duttke

Description

@jens-duttke

In my tsconfig.json I have aliases for specific paths:

{
	"compilerOptions": {
		"paths": {
			"@ui": ["ts/ui"],
			"@utils": ["ts/utils"],

			"@fonts/*": ["fonts/*"],
			"@img/*": ["img/*"],
			"@json/*": ["json/*"],
			"@scss/*": ["scss/*"]
		},

In my WebPack configuration I'm using the same configuration to make Webpack and it's plugins aware of these aliases.

Unfortunately, if I have an @import on such an alias, the typescript-plugin-css-module fails to get the class names.

e.g. a styles.module.scss:

@import "@scss/_custom-media.scss";

.dialog {
	width: 500px;
}

In that case, it does not resolve the alias for "@scss/_custom-media.scss" and the whole module is empty, instead of containing dialog.

TypeScript itself is able to resolve "@scss", so I wonder if it's possible using this plugin to use such aliases too.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesthelp wantedExtra attention is needed

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions