Skip to content

Using pnpm: Error: Can't find stylesheet to import: @use '@material/theme/color-palette'; #348

@derolf

Description

@derolf

I am using svelteKit and I am trying to integrate with SMUI.

** problem **

I am getting an error when trying to compile the theme:

 > smui-theme compile static/smui.css -i src/theme Compiling SMUI Styles... /XXX/node_modules/yargs/build/index.cjs:2772 throw err; ^ Error: Can't find stylesheet to import. ╷ 3 │ @use '@material/theme/color-palette'; │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ╵ src/theme/_smui-theme.scss 3:1 @use ../../node_modules/.pnpm/smui-theme@5.0.0-beta.7/node_modules/smui-theme/_index.scss 1:1 root stylesheet at Object._newRenderError 

My postcss.config.cjs:

/* eslint-disable no-undef */ /* eslint-disable @typescript-eslint/no-var-requires */ const autoprefixer = require("autoprefixer"); module.exports = { extract: true, minimize: true, plugins: [ autoprefixer, ], use: [ [ "sass", { includePaths: [join(__dirname, "src/theme"), join(__dirname, "node_modules")], }, ], ], }; 

** cause ***

I think the problem is with using PNPM as package manager, this fails:

path.dirname(require.resolve('@material/dom/package.json')),

Because of PNPMs linking style, this resolves to

/XXX/node_modules/.pnpm/@material+dom@13.0.0/node_modules

** workaround **

Package.json:

 "smui-theme-light": "smui-theme compile static/smui.css -i src/theme -i ./node_modules", "smui-theme-dark": "smui-theme compile static/smui-dark.css -i src/theme/dark -i ./node_modules" 

I get past the error, but I have to install all @material/ packages by hand.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions