Skip to content
This repository was archived by the owner on Mar 6, 2024. It is now read-only.

Webpack Loader API Support

Ahmad Amireh edited this page May 20, 2016 · 13 revisions

Compatible loader features:

  • this.emitWarning(String)
  • this.emitError(String)
  • this.emitFile(String, String, Object)
  • this.addDependency(String)
  • this.addContextDependency(String)
  • this.clearDependencies()
  • this.callback(err: String, code: String, map: Object) style for yielding code + map
  • async this.callback style for yielding code + map
  • synchronous return style for yielding code
  • pitch loaders (module.exports.pitch) (see #15)
  • this.cacheable() (no op, we're always caching)
  • this.exec (can't support this)
  • this.resolve(module: String) -> String
  • this.resolveSync (can't do this synchronously)
  • this.loadModule

Loader context:

  • this.context
  • this.query
  • this.resourcePath
  • this.resourceQuery
  • this.options (somewhat working, we don't serialize the plugins though or anything with cyclic dependencies)
  • this.data (pitch)
  • this.loaders
  • this.loaderIndex
  • this.values
  • this.inputValues
  • this.debug
  • this.minimize
  • this.sourceMap
  • this.target
  • this.webpack
  • this._compilation
  • this._compiler
  • this._module

Striked out stuff won't be done.

Automated dump

You can generate this list by running ./scripts/loader-support-status/index.js.

Supported properties:
-----------------------------------------------------------------------
1. "_compiler" of type "object"
2. "addContextDependency" of type "function"
3. "addDependency" of type "function"
4. "async" of type "function"
5. "cacheable" of type "function"
6. "callback" of type "function"
7. "clearDependencies" of type "function"
8. "context" of type "string"
9. "dependency" of type "function"
10. "emitError" of type "function"
11. "emitFile" of type "function"
12. "emitWarning" of type "function"
13. "exec" of type "function"
14. "fs" of type "object"
15. "loaderIndex" of type "number"
16. "loaders" of type "object"
17. "options" of type "object"
18. "query" of type "string"
19. "request" of type "string"
20. "resolve" of type "function"
21. "resolveSync" of type "function"
22. "resource" of type "string"
23. "resourcePath" of type "string"
24. "resourceQuery" of type "object"
25. "sourceMap" of type "boolean"
26. "version" of type "number"
27. "webpack" of type "boolean"

Missing properties:
-----------------------------------------------------------------------
1. "_compilation" of type "object"
2. "_module" of type "object"
3. "debug" of type "boolean"
4. "inputValue" of type "undefined"
5. "loadModule" of type "function"
6. "target" of type "string"
7. "value" of type "object"

Property type mismatch:
-----------------------------------------------------------------------
1. "data" is of type "undefined" in webpack, but "object" in happypack.

Clone this wiki locally