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

Prefer selecting 'bundle' artifacts over 'non-bundle' artifacts #22

Merged
merged 1 commit into from
Aug 4, 2019

Conversation

rtyley
Copy link
Contributor

@rtyley rtyley commented Aug 3, 2019

When using the scalajs-bundler sbt plugin and deploying to Heroku, I've had problems with the project-opt.js artifact being selected over the project-opt-bundle.js artifact which is required - I think -bundle artifacts should be preferred - selectScript.scala.html only selects one, so it should be the -bundle one.

This follows on from #17.

Until this fix is released, a workaround for this issue is to hack the value of the resourceExists function sent to selectScript.scala.html, eg adding && name.contains("-bundle"):

@scalajs.html.scripts(
    buildinfo.BuildInfo.name,
    routes.Assets.versioned(_).toString,
    name => getClass.getResource(s"/public/$name") != null && name.contains("-bundle")
)

When using the scalajs-bundler sbt plugin:

https://github.com/scalacenter/scalajs-bundler

...and deploying to Heroku, I've had problems with the `project-opt.js`
artifact being selected over the `project-opt-bundle.js` artifact which
is required - I _think_ `-bundle` artifacts should be preferred -
`selectScript.scala.html` only selects one, so it should be the `-bundle`
one.

This follows on from vmunier#17

Until this fix is released, a workaround for this issue is to hack the
value of the `resourceExists` function sent to `selectScript.scala.html`,
eg adding `&& name.contains("-bundle")`:

```
@scalajs.html.scripts(
    buildinfo.BuildInfo.name,
    routes.Assets.versioned(_).toString,
    name => getClass.getResource(s"/public/$name") != null && name.contains("-bundle")
)
```
@vmunier vmunier merged commit 9ceb6f9 into vmunier:master Aug 4, 2019
@vmunier
Copy link
Owner

vmunier commented Aug 4, 2019

Hi @rtyley,

Thanks for opening this PR. I have not used scalajs-bundler before, but it looks correct to me, the *bundle.js file should be selected first.

scalajs-scripts v1.1.4 contains the fix and has just been published to Maven Central.

@rtyley
Copy link
Contributor Author

rtyley commented Aug 4, 2019

Thank you - I appreciate you doing the release so quickly!

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

Successfully merging this pull request may close these issues.

2 participants