diff --git a/package.json b/package.json index c321daf..0101fd6 100644 --- a/package.json +++ b/package.json @@ -25,7 +25,7 @@ }, "homepage": "http://eploko.github.io/pegjs-loader", "peerDependencies": { - "pegjs": "^0.9.0", + "pegjs": "^0.10.0", "webpack": "^1.12.2" }, "dependencies": { diff --git a/src/index.js b/src/index.js index a451ef4..0433977 100644 --- a/src/index.js +++ b/src/index.js @@ -31,5 +31,6 @@ export default function loader(source) { pegOptions.allowedStartRules = allowedStartRules; } - return `module.exports = ${pegjs.buildParser(source, pegOptions)};`; + const methodName = (typeof pegjs.generate === 'function') ? 'generate' : 'buildParser'; + return `module.exports = ${pegjs[methodName](source, pegOptions)};`; }