Skip to content

Vuepress does not work with versions of vue-cli and vuetify that use sass 8 #2148

Open
@davydnorris

Description

@davydnorris
  • I confirm that this is an issue rather than a question.

Bug report

The default options supplied for sass-loader break Sass 8, and cannot be overridden in config.js

Steps to reproduce

  1. Create a vuepress project and add the latest Vuetify, which will trigger webpack to use Sass.
  2. Execute npm run build
  3. The process will fail with the error:
ValidationError: Invalid options object. Sass Loader has been initialised using an options object that does not match the API schema.
     - options has an unknown property 'indentedSyntax'. These properties are valid:
       object { implementation?, sassOptions?, prependData?, sourceMap?, webpackImporter? }

What is expected?

The site builds without error

What is actually happening?

The default options set for sass-loader are no longer valid for Sass 8. Instead of
{ indentedSyntax: true }
it is now
{ sassOptions: { indentedSyntax: true } }

No matter what you do in your config.js, the original property is set because the values in config.js are merged with the options object.

The problem is in @vuepress/core/lib/node/webpack/createBaseConfig.js, line 257:
createCSSRule('sass', /\.sass$/, 'sass-loader', Object.assign({ /* indentedSyntax: true*/ }, siteConfig.sass))
Commenting out the offending property in this line (as above), fixes the problem. My suggestion is that instead of merging the config, replace it completely. Then you can use the config.js file to adjust to different Sass versions.

Other relevant information

  • Output of npx vuepress info in my VuePress project:

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions