Use default parser for Reify Module.prototype._compile hook.

This saves us from having to install @babel/parser in the server bundle.

There is currently a bug in Reify that prevents it from loading this
parser by default, but we can work around that on the Meteor side for now.
This commit is contained in:
Ben Newman
2019-07-02 15:30:00 -04:00
parent e9060d01df
commit f7f36bb758

View File

@@ -24,12 +24,12 @@ Mp.dynamicImport = function (id) {
return resolved.then(() => require(id));
};
const babelParse = require("reify/lib/parsers/babel").parse;
const parse = require("reify/lib/parsers/default").parse;
const reifyCompile = require("reify/lib/compiler").compile;
const _compile = Mp._compile;
Mp._compile = function (content, filename) {
const result = reifyCompile(content, {
parse: babelParse,
parse: parse,
generateLetDeclarations: false,
ast: false,
});