We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents cff8863 + c7d0a3c commit 6b85561Copy full SHA for 6b85561
index.js
@@ -4,7 +4,8 @@ var loaderUtils = require('loader-utils');
4
module.exports = function(source) {
5
this.cacheable && this.cacheable();
6
var query = loaderUtils.parseQuery(this.query);
7
- var pegOptions = { output: 'source' };
8
- var parser = 'module.exports = ' + pegjs.buildParser(source, pegOptions) + ';';
9
- this.callback(null, parser, null);
+ var cacheParserResults = !!query.cache;
+ // Description of PEG.js options: https://github.com/pegjs/pegjs#javascript-api
+ var pegOptions = { output: 'source', cache: cacheParserResults };
10
+ return 'module.exports = ' + pegjs.buildParser(source, pegOptions) + ';';
11
};
0 commit comments