Closed kfish closed 10 years ago
I thought I just used the same code as for modules generation there, but nope.
I probably won't have time to fix this until next week. If you want to take a stab at it, there's a function createModulePath :: ModuleName a -> Compile [JsStmt]
in Fay.Compiler
that solves the override issues for normal modules, generateStrictExports
should use that as well.
Another related problem would be if you have --strict A.B A
or --strict A A.B
. createModulePath
handles that as well.
nb. this issue refers to separately generating two javascript files and including both from some html. In the output of a single fay invocation:
fay A.hs --strict A,B
(where A.hs imports B.hs) only one "var Strict = {}" is generated.
Oh. There is no way for Fay to know this during compilation then. So it would have to defer all these checks to the runtime, unless #347 is fixed and used. It's vaguely related to #330.
Right, I was generating multiple javascript output files because i couldn't work out how to generate one file containing both modules (ie. #347).
When I posted this issue I thought it might be worth adding options to generate non-standalone --strict stub files which could then be individually sourced, but I agree it's cleaner to just generate one combined js file.
The javascript generated by --strict includes:
If I generate two such modules and include both, then all the Strict.* objects declared by the first module are clobbered by the second: