Skip to content

Commit 0d2c4c3

Browse files
authored
Merge pull request #3144 from bsansouci/pr
Fix import bug with absolute path given to -bs-package-output
2 parents 82a97a9 + 5b8c797 commit 0d2c4c3

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

jscomp/core/js_packages_info.ml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,14 @@ let string_of_module_id
227227
| Package_found(dep_package_name, dep_path),
228228
Package_script
229229
->
230+
#if BS_NATIVE then
231+
if Filename.is_relative dep_path then
232+
dep_package_name // dep_path // js_file
233+
else
234+
dep_path // js_file
235+
#else
230236
dep_package_name // dep_path // js_file
237+
#end
231238

232239
| Package_found(dep_package_name, dep_path),
233240
Package_found(cur_package_name, cur_path) ->
@@ -242,7 +249,14 @@ let string_of_module_id
242249
else
243250
begin match module_system with
244251
| AmdJS | NodeJS | Es6 ->
252+
#if BS_NATIVE then
253+
if Filename.is_relative dep_path then
254+
dep_package_name // dep_path // js_file
255+
else
256+
dep_path // js_file
257+
#else
245258
dep_package_name // dep_path // js_file
259+
#end
246260
(** Note we did a post-processing when working on Windows *)
247261
| Es6_global
248262
| AmdJS_global ->

jscomp/core/lam_compile_main.ml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -324,12 +324,19 @@ let lambda_as_module
324324
output_chan stdout);
325325
if not @@ !Clflags.dont_write_files then
326326
Ext_pervasives.with_file_as_chan
327+
#if BS_NATIVE then
328+
(if Filename.is_relative _path then Lazy.force Ext_filename.package_dir // _path // basename
329+
(* #913 only generate little-case js file *)
330+
else _path // basename) output_chan )
331+
#else
327332
(Lazy.force Ext_filename.package_dir //
328333
_path //
329334
basename
330335
(* #913 only generate little-case js file *)
331336
) output_chan )
332337

338+
#end
339+
333340
(* We can use {!Env.current_unit = "Pervasives"} to tell if it is some specific module,
334341
We need handle some definitions in standard libraries in a special way, most are io specific,
335342
includes {!Pervasives.stdin, Pervasives.stdout, Pervasives.stderr}

0 commit comments

Comments
 (0)