Skip to content

Fix import bug with absolute path given to -bs-package-output #3144

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 11, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions jscomp/core/js_packages_info.ml
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,14 @@ let string_of_module_id
| Package_found(dep_package_name, dep_path),
Package_script
->
#if BS_NATIVE then
if Filename.is_relative dep_path then
dep_package_name // dep_path // js_file
else
dep_path // js_file
#else
dep_package_name // dep_path // js_file
#end

| Package_found(dep_package_name, dep_path),
Package_found(cur_package_name, cur_path) ->
Expand All @@ -242,7 +249,14 @@ let string_of_module_id
else
begin match module_system with
| AmdJS | NodeJS | Es6 ->
#if BS_NATIVE then
if Filename.is_relative dep_path then
dep_package_name // dep_path // js_file
else
dep_path // js_file
#else
dep_package_name // dep_path // js_file
#end
(** Note we did a post-processing when working on Windows *)
| Es6_global
| AmdJS_global ->
Expand Down
7 changes: 7 additions & 0 deletions jscomp/core/lam_compile_main.ml
Original file line number Diff line number Diff line change
Expand Up @@ -324,12 +324,19 @@ let lambda_as_module
output_chan stdout);
if not @@ !Clflags.dont_write_files then
Ext_pervasives.with_file_as_chan
#if BS_NATIVE then
(if Filename.is_relative _path then Lazy.force Ext_filename.package_dir // _path // basename
(* #913 only generate little-case js file *)
else _path // basename) output_chan )
#else
(Lazy.force Ext_filename.package_dir //
_path //
basename
(* #913 only generate little-case js file *)
) output_chan )

#end

(* We can use {!Env.current_unit = "Pervasives"} to tell if it is some specific module,
We need handle some definitions in standard libraries in a special way, most are io specific,
includes {!Pervasives.stdin, Pervasives.stdout, Pervasives.stderr}
Expand Down