├── .gitignore ├── .npmignore ├── LICENSE ├── README.md ├── example ├── README.md ├── build.sbt ├── index.html ├── package.json ├── project │ ├── build.properties │ └── plugins.sbt ├── src │ └── main │ │ └── scala │ │ └── HelloWorld.scala └── webpack.config.js ├── index.js └── package.json /.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | 6 | # Runtime data 7 | pids 8 | *.pid 9 | *.seed 10 | 11 | # Directory for instrumented libs generated by jscoverage/JSCover 12 | lib-cov 13 | 14 | # Coverage directory used by tools like istanbul 15 | coverage 16 | 17 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 18 | .grunt 19 | 20 | # node-waf configuration 21 | .lock-wscript 22 | 23 | # Compiled binary addons (http://nodejs.org/api/addons.html) 24 | build/Release 25 | 26 | # Dependency directory 27 | # https://docs.npmjs.com/misc/faq#should-i-check-my-node-modules-folder-into-git 28 | node_modules 29 | 30 | # Optional npm cache directory 31 | .npm 32 | 33 | # Optional REPL history 34 | .node_repl_history 35 | 36 | *.tgz 37 | 38 | # Example 39 | example/target 40 | example/lib_managed 41 | example/src_managed 42 | example/project/boot 43 | example/.history 44 | example/.cache 45 | example/project/target 46 | example/project/project 47 | example/bundle.js 48 | -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | 6 | # Runtime data 7 | pids 8 | *.pid 9 | *.seed 10 | 11 | # Directory for instrumented libs generated by jscoverage/JSCover 12 | lib-cov 13 | 14 | # Coverage directory used by tools like istanbul 15 | coverage 16 | 17 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 18 | .grunt 19 | 20 | # node-waf configuration 21 | .lock-wscript 22 | 23 | # Compiled binary addons (http://nodejs.org/api/addons.html) 24 | build/Release 25 | 26 | # Dependency directory 27 | # https://docs.npmjs.com/misc/faq#should-i-check-my-node-modules-folder-into-git 28 | node_modules 29 | 30 | # Optional npm cache directory 31 | .npm 32 | 33 | # Optional REPL history 34 | .node_repl_history 35 | 36 | *.tgz 37 | 38 | example 39 | .npmignore 40 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Matt Dziuban 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Scala.js Webpack loader 2 | 3 | [](https://www.npmjs.com/package/scalajs-loader) 4 | 5 | ### Usage 6 | 7 | This is a simple Webpack loader that shells out to SBT to build a [Scala.js](http://www.scala-js.org) project. 8 | 9 | To use it, first install the package: 10 | 11 | ```bash 12 | $ npm install --save scalajs-loader 13 | ``` 14 | 15 | then configure the loader in your Webpack config: 16 | 17 | ```js 18 | module.exports = { 19 | // ... 20 | module: { 21 | rules: [ 22 | { test: /\.scala$/, loader: 'scalajs-loader' }, 23 | // ... 24 | ] 25 | } 26 | } 27 | ``` 28 | 29 | Make sure you have the `sbt` binary somewhere in your `PATH`. 30 | 31 | ### Example 32 | 33 | Check out the [example](example) directory for a simple Hello World example. 34 | -------------------------------------------------------------------------------- /example/README.md: -------------------------------------------------------------------------------- 1 | # Scala.js Webpack loader example 2 | 3 | This is a simple Hello World example of the [Scala.js Webpack loader](https://www.npmjs.com/package/scalajs-loader). 4 | 5 | ### Install dependencies 6 | 7 | ```bash 8 | $ npm install 9 | ``` 10 | 11 | ### Compile 12 | 13 | ```bash 14 | $ npm run compile 15 | ``` 16 | 17 | ### Serve 18 | 19 | Run 20 | 21 | ```bash 22 | $ npm run serve 23 | ``` 24 | 25 | then open http://localhost:8080 in your browser. 26 | -------------------------------------------------------------------------------- /example/build.sbt: -------------------------------------------------------------------------------- 1 | import sbt._ 2 | import Keys._ 3 | 4 | scalacOptions ++= Seq( 5 | "-deprecation", 6 | "-encoding", "UTF-8", // yes, this is 2 args 7 | "-feature", 8 | "-unchecked", 9 | "-Xfatal-warnings", 10 | "-Xlint", 11 | "-Yno-adapted-args", 12 | "-Ywarn-dead-code", // N.B. doesn't work well with the ??? hole 13 | "-Ywarn-infer-any", 14 | "-Ywarn-numeric-widen", 15 | "-Ywarn-unused", 16 | "-Ywarn-value-discard", 17 | "-Xfuture", 18 | "-Ydelambdafy:method", 19 | "-target:jvm-1.8" 20 | ) 21 | 22 | lazy val project = Project( 23 | "scalajs-loader-example", 24 | file("."), 25 | settings = Seq( 26 | organization := "mrdziuban", 27 | name := "scalajs-loader-example", 28 | version := "1.0", 29 | scalaVersion := "2.12.1", 30 | libraryDependencies ++= Seq("org.scala-js" %%% "scalajs-dom" % "0.9.1") 31 | ) 32 | ).enablePlugins(ScalaJSPlugin) 33 | -------------------------------------------------------------------------------- /example/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 |