Fix #4725: apply transpile option to require’d .coffee files (#4728)

* Fix #4725: apply transpile option to require’d .coffee files

* Use the current module’s options if it has any, before going searching up the tree

* Don’t mutate passed-in options object
This commit is contained in:
Geoffrey Booth
2017-10-04 17:49:59 -07:00
committed by GitHub
parent 694e69d872
commit a2037e799f
6 changed files with 47 additions and 18 deletions

View File

@@ -166,3 +166,7 @@ test "using transpile from the Node API requires an object", ->
CoffeeScript.compile '', transpile: yes
catch exception
eq exception.message, 'The transpile option must be given an object with options to pass to Babel'
test "transpile option applies to imported .coffee files", ->
return if global.testingBrowser
doesNotThrow -> transpile 'run', "import { getSep } from './test/importing/transpile_import'\ngetSep()"

View File

@@ -0,0 +1,3 @@
import path from 'path'
export getSep = -> path.sep