Skip to content

The manualInject option doesn't seem to work #40

Open
@stigvanbrabant

Description

@stigvanbrabant

I'm having trouble using the manualInject option for the vue-style-loader while using vue cli 3.

Do you want to request a feature or report a bug?
bug

What is the current behavior?
Styling keeps automaticly injecting the styling into the DOM

If the current behavior is a bug, please provide the steps to reproduce.

Here is my vue.config.js:

module.exports = {
  parallel: true,
  productionSourceMap: false,
  chainWebpack: (config) => {
    config.resolve.symlinks(false);

    ['vue-modules', 'vue', 'normal-modules', 'normal'].forEach((type) => {
      config.module.rule('scss').oneOf(type).use('vue-style-loader').tap((opt) => {
        opt.manualInject = true;
        return opt;
      });

      config.module.rule('sass').oneOf(type).use('vue-style-loader').tap((opt) => {
        opt.manualInject = true;
        return opt;
      });

      config.module.rule('css').oneOf(type).use('vue-style-loader').tap((opt) => {
        opt.manualInject = true;
        return opt;
      });
    });
  },
};

Inside my main.js

The import:

import styling from './assets/scss/global.scss';

The injection inside my mounting function:

if (styling && styling.__inject__) {
  styling.__inject__();
}

What is the expected behavior?

Ability to manually inject styling by using styling.__inject__().

Please mention other relevant information such as your webpack version, Node.js version and Operating System.

Node version: v10.16.0
OS: Mac OS 10.16.6
Webpack: 4.28.4

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions