From e51dd52f23b1dee554d059ef929ea09b076c102a Mon Sep 17 00:00:00 2001 From: Jason Chen Date: Wed, 6 Dec 2017 16:32:52 +0800 Subject: [PATCH] Pass `sourcemap` option to the compiler. --- index.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index dae2e82..e06861f 100644 --- a/index.js +++ b/index.js @@ -13,8 +13,16 @@ module.exports = function surplus(options) { transform: function (code, id) { if (!filter(id)) return null; - - return compiler.compile(code, { }); + + var map; + if (options.sourcemap) { + var map = compiler.compile(code, {sourcemap: options.sourcemap}).map; + } + var code = compiler.compile(code, {}); + return { + code: code, + map: map + }; } }; }