Skip to content
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

when toplevel package-specs get changed, its dependencies need rebuilt #5154

Closed
Minnozz opened this issue May 27, 2021 · 4 comments
Closed

Comments

@Minnozz
Copy link
Contributor

Minnozz commented May 27, 2021

Relevant sections of bsconfig.json:

  "sources": {
    "dir": "src",
    "subdirs": true
  },
  "package-specs": [
    {
      "module": "es6", // Works with "commonjs"
      "in-source": false
    }
  ],
  "bs-dependencies": [
    "rescript-jzon"
  ]

In a source file located at src/Subdir/Foo.res, I reference Jzon. In commonjs mode, this works fine. When I switch to es6 output, I get the following compiler error:

rescript: [84/118] src/Subdir/Foo-Project.cmj
FAILED: src/Subdir/Foo-Project.cmj

  We've found a bug for you!
  /home/username/project/src/Subdir/Foo.res

  Missing dependency Jzon in search path

On rescript v9.1.2

@bobzhang
Copy link
Member

can you create a minimal repo so that I can reproduce? changie the module format should have a minimal impact on build

@Minnozz
Copy link
Contributor Author

Minnozz commented May 29, 2021

Yes, see here: https://github.com/Minnozz/rescript-issue-5154

@Minnozz Minnozz changed the title Compiler cannot locate bs-dependency from subdir after switching from commonjs to es6 output Compiler cannot locate bs-dependency after switching from commonjs to es6 output May 29, 2021
@bobzhang
Copy link
Member

This is because when you change package-specs, your build dependencies also need get rebuilt.
The current work around is do a clean when you change package-specs

@bobzhang bobzhang changed the title Compiler cannot locate bs-dependency after switching from commonjs to es6 output when toplevel package-specs get changed, its dependencies need rebuilt May 29, 2021
@Minnozz
Copy link
Contributor Author

Minnozz commented May 29, 2021

Thanks, that explains it!

bobzhang added a commit that referenced this issue May 30, 2021
bobzhang added a commit that referenced this issue May 30, 2021
bobzhang added a commit that referenced this issue Jun 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants