Skip to content

using vue-loader?inject with scss and webpack 2 fails to find loader #724

@squirmy

Description

@squirmy

When using the inject option of the vue-loader in webpack 2 it doesn't get the options that have been passed into it in the webpack configuration.

This part in the vuejs webpack template:

  // http://vuejs.github.io/vue-loader/en/configurations/extract-css.html
  return {
    css: generateLoaders(),
    postcss: generateLoaders(),
    less: generateLoaders('less'),
    sass: generateLoaders('sass', { indentedSyntax: true }),
    scss: generateLoaders('sass'),
    stylus: generateLoaders('stylus'),
    styl: generateLoaders('stylus')
  }

This is fine for most loaders as they are named the same as the lang option in the single file vue component. However, as you can see above, scss uses the sass loader which causes vue-loader to not find the loader when passing in the inject parameter.

There is a solution here. Where it creates two configurations; one with inject, and one without. This works, but you then hit another problem in that coverage cannot find the source file as it has the query parameter appended to the filename.

Considering I don't even need the styles in my unit tests - this all just seems a bit hard and I'm wondering if it's the correct approach.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions