Skip to content

Commit 8f78844

Browse files
committed
Merge retorquere/pegjs-loader.git patch-1
2 parents 07998e7 + a21ca81 commit 8f78844

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/index.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,17 @@ export default function loader(source) {
2323

2424
// Description of PEG.js options: https://github.com/pegjs/pegjs#javascript-api
2525
const pegOptions = {
26-
output: 'source',
2726
cache: cacheParserResults,
27+
dependencies: dependencies,
28+
format: 'commonjs',
2829
optimize: optimizeParser,
30+
output: 'source',
2931
trace: trace,
30-
dependencies: dependencies,
3132
};
3233
if (allowedStartRules.length > 0) {
3334
pegOptions.allowedStartRules = allowedStartRules;
3435
}
3536

3637
const methodName = (typeof pegjs.generate === 'function') ? 'generate' : 'buildParser';
37-
return `module.exports = ${pegjs[methodName](source, pegOptions)};`;
38+
return pegjs[methodName](source, pegOptions);
3839
}

0 commit comments

Comments
 (0)