diff --git a/src/transform.js b/src/transform.js index d1350321..dee2e3e0 100644 --- a/src/transform.js +++ b/src/transform.js @@ -14,13 +14,18 @@ module.exports = async function(source, options) { if (!result) return null; - const { code, map, metadata } = result; + // We don't return the full result here because some entries are not + // really serializable. For a full list of properties see here: + // https://github.com/babel/babel/blob/master/packages/babel-core/src/transformation/index.js + // For discussion on this topic see here: + // https://github.com/babel/babel-loader/pull/629 + const { ast, code, map, metadata, sourceType } = result; if (map && (!map.sourcesContent || !map.sourcesContent.length)) { map.sourcesContent = [source]; } - return { code, map, metadata }; + return { ast, code, map, metadata, sourceType }; }; module.exports.version = babel.version;