The loader returns the sourcecode and optional a sourcemap by calling
this.callback(null, source, map); But how can I return additional metadata which should be retrieved in a webpack plugin when iterating over all modules?
The real problem is when generating messages for translation from modules:
- there is the babel-react-intl plugin, which returns the messages it finds in the module in the metadata[react-int] property. (babel returns not only source code and source map but also the ast and the metadata property )
- babel loader returns only source code and source map but nothing else so I would like to modify it to return the metadata too, so that I can access it in a webpack plugin via
compilation.modules[moduleId].metadataor via the already found
How can this be done?