laravel-mix configuration for vue-loader

房东的猫 提交于 2019-12-13 03:45:04

问题


I was trying to create a css modules using vuejs. However, I cannot figure out how to configure the webpack.

Here is my Vue component

  <template>
    <div>
      <div :class="$style.header_top">
      </div>
    </div>
  </template>
  <style module lang="scss">
    $black: #1e1e1e;
    $white: #fff;

    .header {
      position: absolute;
      width: 100%;

      &_top {
        background-color: $black;
        padding: 15px 0;
      }
     ....
   </style>

This is my laravel-mix configuration:

    mix.webpackConfig({
      module: {
        rules: [
          {
            test: /\.css$/,
            resourceQuery: '/module/',
            loaders: [
              'vue-style-loader',
              'css-loader',
              {
                loader: 'sass-loader',
                options: {
                  modules: true,
                  localIdentName: '[local]_[hash:base64:8]',
                },
              },
              'vue-loader'
            ]
          },
        ],
      }
    });

I don't have any experience with webpack and it is almost 8 hours now since i started doing this and the only progress that I made is that it is now compiling :D.

Thank you in advance.

来源:https://stackoverflow.com/questions/55350951/laravel-mix-configuration-for-vue-loader

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!