vue-cli icon indicating copy to clipboard operation
vue-cli copied to clipboard

如何添加style-loader

Open ghost opened this issue 7 years ago • 1 comments

Version

3.1.1

Node and OS info

node:8.11.1 npm 5.6.0

Steps to reproduce

如何在vuecli3.0创建的项目中添加style-loader. 因为我想使用style-loader中的useble 这个功能。或者有其他的方式可以替代这个功能吗

What is expected?

期望能有一个配置style-loader的案例或者提供一个替代的方案

What is actually happening?

没有找到相关的配置信息

ghost avatar Nov 03 '18 01:11 ghost

module.exports = {
  chainWebpack: config => {
    // 添加 style-loader
    config.module
      .rule('css')
      .oneOf('normal')
      .use('style-loader')
      .loader('style-loader')
      .end();

    // 如果需要使用useable功能,也可以在这里配置
    // 例如,给所有的css文件使用useable
    config.module
      .rule('css')
      .oneOf('normal')
      .use('style-loader')
      .loader('style-loader/useable')
      .end();
  }
};

ljluestc avatar Apr 13 '24 18:04 ljluestc