This repository has been archived by the owner on Mar 6, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 125
Webpack Loader API Support
Ahmad Amireh edited this page Sep 11, 2017
·
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) -
(can't support this)this.exec
-
this.resolve(module: String) -> String
-
(can't do this synchronously)this.resolveSync
-
this.loadModule
(since 2.2.0)
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.
You can generate this list by running NODE_PATH=upstream/webpack1/node_modules ./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. "loadModule" of type "function"
16. "loaderIndex" of type "number"
17. "loaders" of type "object"
18. "options" of type "object"
19. "query" of type "string"
20. "request" of type "string"
21. "resolve" of type "function"
22. "resolveSync" of type "function"
23. "resource" of type "string"
24. "resourcePath" of type "string"
25. "resourceQuery" of type "object"
26. "sourceMap" of type "boolean"
27. "target" of type "string"
28. "version" of type "number"
29. "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. "value" of type "object"
Property type mismatch:
-----------------------------------------------------------------------
1. "data" is of type "undefined" in webpack, but "object" in happypack.
Extraneous properties (possibly deprecated?):
-----------------------------------------------------------------------
1. "_contextDependencies" is of type "undefined" in webpack, but "undefined" in happypack.
2. "_dependencies" is of type "undefined" in webpack, but "undefined" in happypack.
3. "_remoteLoaderId" is of type "undefined" in webpack, but "string" in happypack.
4. "getContextDependencies" is of type "undefined" in webpack, but "function" in happypack.
5. "getDependencies" is of type "undefined" in webpack, but "function" in happypack.
6. "inputValues" is of type "undefined" in webpack, but "object" in happypack.
7. "minimize" is of type "undefined" in webpack, but "undefined" in happypack.
8. "result" is of type "undefined" in webpack, but "object" in happypack.
You can generate this list by running NODE_PATH=upstream/webpack2/node_modules ./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. "data" of type "object"
10. "dependency" of type "function"
11. "emitError" of type "function"
12. "emitFile" of type "function"
13. "emitWarning" of type "function"
14. "exec" of type "function"
15. "fs" of type "object"
16. "getContextDependencies" of type "function"
17. "getDependencies" of type "function"
18. "loadModule" of type "function"
19. "loaderIndex" of type "number"
20. "loaders" of type "object"
21. "options" of type "object"
22. "query" of type "string"
23. "request" of type "string"
24. "resolve" of type "function"
25. "resolveSync" of type "function"
26. "resource" of type "string"
27. "resourcePath" of type "string"
28. "resourceQuery" of type "string"
29. "sourceMap" of type "boolean"
30. "target" of type "string"
31. "version" of type "number"
32. "webpack" of type "boolean"
Missing properties:
-----------------------------------------------------------------------
1. "_compilation" of type "object"
2. "_module" of type "object"
3. "currentRequest" of type "string"
4. "previousRequest" of type "string"
5. "remainingRequest" of type "string"
Extraneous properties (possibly deprecated?):
-----------------------------------------------------------------------
1. "_contextDependencies" is of type "undefined" in webpack, but "object" in happypack.
2. "_dependencies" is of type "undefined" in webpack, but "object" in happypack.
3. "_remoteLoaderId" is of type "undefined" in webpack, but "string" in happypack.
4. "inputValues" is of type "undefined" in webpack, but "object" in happypack.
5. "minimize" is of type "undefined" in webpack, but "undefined" in happypack.
6. "result" is of type "undefined" in webpack, but "object" in happypack.
You can generate this list by running NODE_PATH=upstream/webpack3/node_modules ./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. "data" of type "object"
10. "dependency" of type "function"
11. "emitError" of type "function"
12. "emitFile" of type "function"
13. "emitWarning" of type "function"
14. "exec" of type "function"
15. "fs" of type "object"
16. "getContextDependencies" of type "function"
17. "getDependencies" of type "function"
18. "loadModule" of type "function"
19. "loaderIndex" of type "number"
20. "loaders" of type "object"
21. "options" of type "object"
22. "query" of type "string"
23. "request" of type "string"
24. "resolve" of type "function"
25. "resolveSync" of type "function"
26. "resource" of type "string"
27. "resourcePath" of type "string"
28. "resourceQuery" of type "string"
29. "sourceMap" of type "boolean"
30. "target" of type "string"
31. "version" of type "number"
32. "webpack" of type "boolean"
Missing properties:
-----------------------------------------------------------------------
1. "_compilation" of type "object"
2. "_module" of type "object"
3. "currentRequest" of type "string"
4. "previousRequest" of type "string"
5. "remainingRequest" of type "string"
Extraneous properties (possibly deprecated?):
-----------------------------------------------------------------------
1. "_contextDependencies" is of type "undefined" in webpack, but "object" in happypack.
2. "_dependencies" is of type "undefined" in webpack, but "object" in happypack.
3. "_remoteLoaderId" is of type "undefined" in webpack, but "string" in happypack.
4. "inputValues" is of type "undefined" in webpack, but "object" in happypack.
5. "minimize" is of type "undefined" in webpack, but "undefined" in happypack.
6. "result" is of type "undefined" in webpack, but "object" in happypack.