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

Non *.js required files provided in resources folder but missing in target/scala-2.11/scalajs-bundler/ #201

christobill opened this Issue Jan 15, 2018 · 2 comments


None yet
3 participants

christobill commented Jan 15, 2018

Let's say I want to use my-module.js in my project
It requires config.json


src/main/resources/my-module.js looks like:

var uuid = require('uuid');
var config = require('./config.json');


module.exports = {
  someUuid: uuid.v4()

the corresponding facade:

package example

import scala.scalajs.js
import scala.scalajs.js.annotation.JSImport

@JSImport("./my-module", JSImport.Namespace)
object MyModule extends js.Object {
  val someUuid: String = js.native

and the main:

package example

import scala.scalajs.js.JSApp

object Main extends JSApp {

  def main(): Unit = {


I get the following error:

[info] Running example.Main
[error] module.js:544
[error]     throw err;
[error]     ^
[error] Error: Cannot find module './config.json'
[error]     at Function.Module._resolveFilename (module.js:542:15)
[error]     at Function.Module._load (module.js:472:25)
[error]     at Module.require (module.js:585:17)
[error]     at require (internal/module.js:11:18)

This comment has been minimized.


julienrf commented Jan 15, 2018

We currently delegate to scalaJSNativeLibraries to collect these resources but we might want to make this process more extensible and allow users to define more resources. We could do that by introducing a scalaJSResources key whose default value would be scalaJSNativeLibraries.value.


This comment has been minimized.


sjrd commented Jan 15, 2018

Note that scalaJSNativeLibraries will go away in Scala.js 1.x. So instead of defaulting to scalaJSNativeLibraries.value, it would be a good opportunity to make scalaJSResources default to the copy-paste of the implementation of scalaJSNativeLibraries from

@julienrf julienrf added this to the 1.0 milestone Jan 15, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment