https://github.com/axtgr/webpack-loader-modules
Retrieve the list of the modules processed by a loader
https://github.com/axtgr/webpack-loader-modules
Last synced: over 1 year ago
JSON representation
Retrieve the list of the modules processed by a loader
- Host: GitHub
- URL: https://github.com/axtgr/webpack-loader-modules
- Owner: axtgr
- Created: 2015-10-25T01:56:33.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2015-10-26T08:05:08.000Z (over 10 years ago)
- Last Synced: 2025-02-19T13:40:02.311Z (over 1 year ago)
- Language: JavaScript
- Size: 129 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# webpack-loader-modules
A [webpack](http://webpack.github.io/) plugin that allows you to retrieve the list of the modules processed by a loader.
## Install
`npm install -D webpack-loader-modules`
## Example
Here we use [compiler-webpack-plugin](https://github.com/elliottsj/compiler-webpack-plugin) to copy all the template modules to another chunk.
```javascript
var LoaderModules = require('webpack-loader-modules');
var CompilerPlugin = require('compiler-webpack-plugin');
var templateModules = new LoaderModules();
module.exports = {
module: {
loaders: [
test: /\.jade$/,
loader: templateModules.loader('html!jade')
]
},
plugins: [
new CompilerPlugin('this-compilation', function(compilation) {
compilation.plugin('optimize-chunks', function(chunks) {
var templates = templateModules.get();
templates.forEach(function(template) {
template.addChunk(chunks[0]);
chunks[0].addModule(template);
});
});
});
]
};
```