Skip to content

Instantly share code, notes, and snippets.

@joakin
Created August 19, 2015 20:56
Show Gist options
  • Save joakin/884cf3a1b013944f8dd1 to your computer and use it in GitHub Desktop.
Save joakin/884cf3a1b013944f8dd1 to your computer and use it in GitHub Desktop.
Track i18n keys
var ConstDependency = require("webpack/lib/dependencies/ConstDependency");
var NullFactory = require("webpack/lib/NullFactory");
module.exports = ResourceLoaderGenerator;
function ResourceLoaderGenerator (opts) {
opts = opts || {};
this.functionName = opts.functionName || 'msg';
}
ResourceLoaderGenerator.prototype.apply = function(compiler) {
compiler.plugin("compilation", function(compilation, params) {
// compilation.dependencyFactories.set(ConstDependency, new NullFactory());
// compilation.dependencyTemplates.set(ConstDependency, new ConstDependency.Template());
});
compiler.parser.plugin("call " + this.functionName, function (expr) {
console.dir(expr);
});
};
@oliviertassinari
Copy link

@joakin, you can use https://github.com/oliviertassinari/i18n-extract if you just when to extract a list of key

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment