Skip to content

Commit 858c7b5

Browse files
committed
Force bare: true option if a file contains an import or export statement
1 parent 0bb6dcd commit 858c7b5

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/coffee-script.coffee

+7
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,13 @@ exports.compile = compile = withPrettyErrors (code, options) ->
6363
token[1] for token in tokens when token[0] is 'IDENTIFIER'
6464
)
6565

66+
# Check for import or export; if found, force bare mode
67+
unless options.bare? and options.bare is yes
68+
for token in tokens
69+
if token[0] is 'IMPORT' or token[0] is 'EXPORT'
70+
options.bare = yes
71+
break
72+
6673
fragments = parser.parse(tokens).compileToFragments options
6774

6875
currentLine = 0

0 commit comments

Comments
 (0)