diff --git a/lib/index.js b/lib/index.js index 47574f2..cc4e756 100644 --- a/lib/index.js +++ b/lib/index.js @@ -10,11 +10,14 @@ module.exports = function(contents, sourcemap) { const id = genId(this.resourcePath) let hasComponent = false - const ast = acorn.parse(contents, { - sourceType: 'module', - locations: true, - sourceFile: this.resourcePath - }) + const parseOptions = {sourceType: 'module'} + + if (this.sourceMap) { + parseOptions.locations = true + parseOptions.sourceFile = this.resourcePath + } + + const ast = acorn.parse(contents, parseOptions) const res = estraverse.replace(ast, { enter (node, parent) {