vue-loader-for-apache-weex icon indicating copy to clipboard operation
vue-loader-for-apache-weex copied to clipboard

feat: enable the loaders chain

Open songjinzhong opened this issue 6 years ago • 1 comments

I wrote a loader for my project before weex-loader(failed) and vue loader(success), my webpack.config.js like:

module: {
  rules: [
    {
      test: /\.vue$/,
      use: [
        isWeeb ? 'vue-loader' : 'weex-loader',
        'my-loader'  // my loader here
      ]
    }
  ]
}

Failed to work in weex-loader, I found the reason from vue loader: vue-loader#loader.js, and weex-vue-loader use filePath but not rawRequest.

// before
require("!!weex-loader/node_modules/weex-vue-loader/lib/style-loader!weex-loader/node_modules/weex-vue-loader/lib/style-rewriter?id=data-v-cf012960!weex-loader/node_modules/weex-vue-loader/lib/selector?type=styles&index=0!./index.vue"

// after
require("!!weex-loader/node_modules/weex-vue-loader/lib/style-loader!weex-loader/node_modules/weex-vue-loader/lib/style-rewriter?id=data-v-cf012960!weex-loader/node_modules/weex-vue-loader/lib/selector?type=styles&index=0!../../common/myLoader.js??ref--1-0!./index.vue"

It will apply the loaders chained before weex-vue-loader

songjinzhong avatar Apr 26 '18 07:04 songjinzhong

+1

buaaljy avatar Oct 27 '18 06:10 buaaljy