From 2d7a2b5e6d34f934f4b83bd0f1d4334952360d35 Mon Sep 17 00:00:00 2001 From: Sebastian McKenzie Date: Fri, 24 Jul 2015 21:09:27 +0100 Subject: [PATCH] add sourceType option --- packages/babel/src/transformation/file/index.js | 2 +- packages/babel/src/transformation/file/options/config.json | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/babel/src/transformation/file/index.js b/packages/babel/src/transformation/file/index.js index 536e21144f..f58ac13940 100644 --- a/packages/babel/src/transformation/file/index.js +++ b/packages/babel/src/transformation/file/index.js @@ -509,6 +509,7 @@ export default class File { var parseOpts = { highlightCode: opts.highlightCode, nonStandard: opts.nonStandard, + sourceType: opts.sourceType, filename: opts.filename, plugins: {} }; @@ -521,7 +522,6 @@ export default class File { parseOpts.looseModules = this.isLoose("es6.modules"); parseOpts.strictMode = features.strict; - parseOpts.sourceType = "module"; this.log.debug("Parse start"); var ast = parse(code, parseOpts); diff --git a/packages/babel/src/transformation/file/options/config.json b/packages/babel/src/transformation/file/options/config.json index 58ee9b24e2..205b06eefb 100644 --- a/packages/babel/src/transformation/file/options/config.json +++ b/packages/babel/src/transformation/file/options/config.json @@ -260,5 +260,10 @@ "babelrc": { "description": "Specify a custom list of babelrc files to use", "type": "list" + }, + + "sourceType": { + "description": "", + "default": "module" } }