by

Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • May 27 13:45
    cquiroz commented #350
  • May 27 06:24
    Programmerino opened #350
  • May 21 17:59
    MasseGuillaume opened #349
  • May 21 17:59

    MasseGuillaume on npm-config-hash

    Add additionalNpmConfig and tar… (compare)

  • May 20 11:45

    cquiroz on master

    More updated tests Signed-off-… Merge pull request #348 from cq… (compare)

  • May 20 11:45
    cquiroz closed #348
  • May 20 03:59
    cquiroz opened #348
  • May 19 21:46
    dispalt commented #336
  • May 19 15:48

    cquiroz on master

    Update custom-test-config Sign… Merge pull request #347 from cq… (compare)

  • May 19 15:48
    cquiroz closed #347
  • May 19 14:35
    cquiroz opened #347
  • May 19 09:23
    kalejami edited #346
  • May 19 09:22
    kalejami edited #346
  • May 19 09:21
    kalejami edited #346
  • May 19 09:17
    kalejami opened #346
  • May 19 04:53

    sjrd on master

    Update webpack-assets-cookbook … Merge pull request #345 from cq… (compare)

  • May 19 04:53
    sjrd closed #345
  • May 19 01:27
    cquiroz opened #345
  • May 18 21:08
    easel commented #337
  • May 18 18:48

    cquiroz on master

    Update test case for scala.js r… Merge pull request #344 from cq… (compare)

Anthony Cerruti
@srnb_gitlab
Alright, once I convert it, how can I get scalajs-bundler to pick it up?
Roman Janusz
@ghik

I assume that you're going to have a Scala.js facade for that JS API (e.g. represented as scala object). It would look something like this:

@js.native @JSImport("./myjslib.js", JSImport.Namespace)
object MyJsLib extends js.Object { ... }

If you use that object somewhere in Scala code, scalajs compiler will insert a require/import into the output JS and it will be picked up by webpack.

The details depend on how exactly that JS file exports its API
Anthony Cerruti
@srnb_gitlab

I could do exactly

module.exports = Foo;

in the JS file, that'll be easy.

Where does the myjslib.js go? src/main/resources? src/main/js?

Roman Janusz
@ghik
I keep that in src/main/js but resources might work too.
Anthony Cerruti
@srnb_gitlab
I'll put it in src/main/js because it's not really a resource
Roman Janusz
@ghik
That export should do it.
And as mentioned earlier, you probably don't need to worry about the minified version because webpack will minify it anyway.
Anthony Cerruti
@srnb_gitlab
Yeah, I'm definitely going to include the development version and not the minified version
Anthony Cerruti
@srnb_gitlab
So in my SBT I have baz that depends on bar that depends on foo. It's not finding foo/src/main/js/myjslib.js. I'll get the actual output log in a sec
Basically it's not copyingfoo/src/main/js/myjslib.js to baz/target/scala-2.13/scalajs-bundler/main/myjslib.js
Anthony Cerruti
@srnb_gitlab
When I manually copy it, it works
Additionally, the output JS file tries to use require
Anthony Cerruti
@srnb_gitlab
Got it working. Thank you so much @ghik :pray:
I still have to manually copy over my JS file, but it's a small inconvenience and I may end up writing an SBT task to do it
Roman Janusz
@ghik
:+1:
I had the same problem with JS file from a dependency module. I fixed it with:
Compile / jsSourceDirectories ++= (dependency / Compile / jsSourceDirectories).value,
Anthony Cerruti
@srnb_gitlab
I tried to do that and IntelliJ crashed
This week is not my week
Roman Janusz
@ghik
I don't think that IntelliJ interprets this option
Anyway, it works for me
Note that it's jsSourceDirectories, not sourceDirectories
Anthony Cerruti
@srnb_gitlab
Nah, it worked fine; when IntelliJ actually crashed when I tried to add ScalaJSBundler to the enablePlugins of dependency
(jsSourceDirectories isn't valid without the plugin enabled on the dependency)
Roman Janusz
@ghik
That's interesting because I have exactly that kind of setup and IntelliJ doesn't complain
Anthony Cerruti
@srnb_gitlab
/shrug dunno
It worked this time
Roman Janusz
@ghik
Although wait, I'm not using any JS/JVM cross-project supporting SBT plugins. I set that up manually due to reasons.
Anthony Cerruti
@srnb_gitlab
I'm not crossprojecting either
Oh coooool! I segfaulted the JVM!
This week is really not my week
Roman Janusz
@ghik
plot thickens
Anthony Cerruti
@srnb_gitlab
As soon as I get a monitor with a digital port instead of an analog one I'm moving away from Windows

It's erroring on

"undefined" == typeof _pio && (_pio = {}),

with a referenceerror saying _pio is not defined when the point is literally to define it if it's not defined??

Anthony Cerruti
@srnb_gitlab
Finally, got it working again
And this solution should work Forever:tm:
OlegYch
@OlegYch
hey folks, i'm updating an app from scalajs 0.6 and bundler 0.16, and not sure what's happening here https://github.com/scalacenter/scastie/blob/scalajs1/client/src/main/resources/dev-common.js#L1
what's $e and where is it gone in bundler 0.18 ?
Sébastien Doeraene
@sjrd
That sounds fishy to begin with.
$e makes me think of one of the internal compiler-generated vars that the Scala.js compiler uses for its own purposes, but that's not supposed to be accessible.
I can imagine ways to circumvent Scala.js' protections in 0.6.x, that would somehow allow to access it from .js code, but that's really really bad, and not possible in 1.x.
OlegYch
@OlegYch
i've seen this https://gitter.im/scalacenter/scalajs-bundler?at=5d0d2eb141654c559ed5f400 and thought it's something created by bundler
Sébastien Doeraene
@sjrd
If I'm right, then it seems this code is trying to add a sort of top-level export to the bundle. Something which can now be done with @JSExporTopLevel("ScastieSettings") val settings = new js.Object{ val defaultServerUrl = "" }
I suggest you try to get rid of that thing before upgrading to 1.x, while staying on 0.6.x, using the better tools we have in recent versions, like @JSExportTopLevel val.
OlegYch
@OlegYch
hm, indeed just removing $e seems to have worked
thanks
Anthony Cerruti
@srnb_gitlab
I have a dependency that uses ScalablyTypedConverter, i.e. it has an additional Compile / npmDependencies, and that's not getting packaged with my bundle when I dependant/fullOptJS::webpack.
I assume it's some setting I need to fix on my end, but I don't know exactly how
Anthony Cerruti
@srnb_gitlab
I was using the wrong package from ScalablyTypedConverter. Apparently .mod is used for when module/webpack support is needed
3 replies