Rescript-compiler: Bug in bsconfig where sources[i].bs-dependencies isn't respected

Created on 3 Apr 2017  路  3Comments  路  Source: rescript-lang/rescript-compiler

I've create a minimal example here: https://github.com/wyze/bucklescript-bsconfig-bug

If I move the bs-dependencies node up to the top level from sources, it works. The above repo produces the following output currently:

> bsb -make-world

BSB check build spec : OK

Making the dependency world!
Package stack: bucklescript-bsconfig-bug
ninja.exe -C lib/bs
ninja: Entering directory `lib/bs'
[1/1] Building __tests__/sum_test.cmj /Users/neil/Projects/pers...escript-bsconfig-bug/lib/js/__tests__/sum_test.js __tests__/sum_test.cmi
FAILED: __tests__/sum_test.cmj /Users/neil/Projects/personal/bucklescript-bsconfig-bug/lib/js/__tests__/sum_test.js __tests__/sum_test.cmi
/Users/neil/Projects/personal/bucklescript-bsconfig-bug/node_modules/bs-platform/bin/bsc.exe -bs-package-name bucklescript-bsconfig-bug  -bs-package-output commonjs:lib/js/__tests__ -bs-assume-no-mli -bs-no-builtin-ppx-ml -bs-no-implicit-include  -bs-package-include bs-jest -I src -I __tests__ -nostdlib -I /Users/neil/Projects/personal/bucklescript-bsconfig-bug/node_modules/bs-platform/lib/ocaml -no-alias-deps -color always -w -40+6+7+27+32..39+44+45 -o __tests__/sum_test.mlast -c  __tests__/sum_test.mlast
/Users/neil/Projects/personal/bucklescript-bsconfig-bug/node_modules/bs-platform/bin/bsc.exe: unknown option '-bs-package-include'.

And also prints the usage for bsc.exe.

GOOD FIRST TASK GOOD FOR PR HIGH

Most helpful comment

based on discussions, instead of fixing such bug, the solution is to add dev dependencies explicitly via

"bs-dependencies": { "dev" : [ "a", ... ], "lib" : ... }

Note it would be backward compatible, "bs-dependencies" will accept array as well

All 3 comments

based on discussions, instead of fixing such bug, the solution is to add dev dependencies explicitly via

"bs-dependencies": { "dev" : [ "a", ... ], "lib" : ... }

Note it would be backward compatible, "bs-dependencies" will accept array as well

@wyze please change your bsconfig.json per #1493

{
  "name": "bucklescript-bsconfig-bug",
    "bs-dev-dependencies": [
        "bs-jest"
      ],
  "sources": [
    "src",
    {

      "dir": "__tests__",
      "type": "dev"
    }
  ]
}

Confirmed it is now working. Thanks for the quick fix @bobzhang!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

TheSpyder picture TheSpyder  路  5Comments

bobzhang picture bobzhang  路  5Comments

chenglou picture chenglou  路  4Comments

cknitt picture cknitt  路  3Comments

paparga picture paparga  路  5Comments