Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: enable the loaders chain #29

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

songjinzhong
Copy link

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

@@ -59,6 +71,7 @@ module.exports = function (content) {
var params = this.resourceQuery && loaderUtils.parseQuery(this.resourceQuery)
var options = this.options.__vueOptions__ = Object.assign({}, this.options.vue, this.vue, query)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The this.options here may not always exist, (webpack 3+).

@buaaljy
Copy link

buaaljy commented Oct 27, 2018

+1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants