angulate2-scalajs-bundler
raw JSON → 1.0.3 verified Sat Apr 25 auth: no javascript abandoned
A webpack plugin that simplifies bundling scalajs projects using angulate2 (Angular 2 for Scala.js) with the scalajs-bundler. This package (v1.0.3, last release unknown) automates configuration of webpack to include required Angular 2 dependencies (e.g., @angular/core, rxjs, zone.js) and outputs the bundled application into a dist folder. It is a thin integration layer between scalajs-bundler and angulate2, requiring manual setup of sbt and webpack config files. Alternatives exist like manual webpack config or newer Scala.js bundling approaches.
Common errors
error Module not found: Error: Cannot resolve module 'angulate2-scalajs-bundler' ↓
cause Package not installed or not listed in npmDevDependencies; webpack cannot find the module.
fix
Run 'npm install angulate2-scalajs-bundler --save-dev' or ensure it's added to npmDevDependencies in build.sbt and scalajs-bundler runs npm install.
error Error: angulate2ScalaJsBundler.apply is not a function ↓
cause Incorrect import or the variable is undefined; possibly wrong require statement.
fix
Use: const angulate2ScalaJsBundler = require('angulate2-scalajs-bundler'); (not import).
error TypeError: Cannot read property 'apply' of undefined ↓
cause The required module returned undefined; maybe package is not installed correctly or version mismatch.
fix
Reinstall the package: 'npm install angulate2-scalajs-bundler@1.0.3 --save-dev' and check node_modules exists.
Warnings
breaking Package is unmaintained and uses outdated Angular 2 (v2.4.0) and rxjs v5; not compatible with Angular 4+ or newer Scala.js versions. ↓
fix Migrate to Scala.js bundler with manual webpack config for newer Angular versions or use a different Scala.js Angular binding.
deprecated Angular 2 has been superseded by Angular 4+, and rxjs v5 is deprecated; the dependencies in the README are outdated. ↓
fix Update to Angular 6+ and rxjs 6+ with corresponding Scala.js bindings, but this package is unlikely to work.
gotcha The plugin must be applied after requiring scalajs.webpack.config; order of operations in webpack.config.js matters. ↓
fix Follow the exact order: require config, set context, then apply plugin.
gotcha The project name argument to apply() must match the sbt project name exactly; mismatch causes bundling failure. ↓
fix Verify sbt project name (case-sensitive) in build.sbt and use the same string in apply().
Install
npm install angulate2-scalajs-bundler yarn add angulate2-scalajs-bundler pnpm add angulate2-scalajs-bundler Imports
- angulate2ScalaJsBundler wrong
import angulate2ScalaJsBundler from 'angulate2-scalajs-bundler';correctconst angulate2ScalaJsBundler = require('angulate2-scalajs-bundler');
Quickstart
// In webpack.config.js
const angulate2ScalaJsBundler = require('angulate2-scalajs-bundler');
// Assume scalajs.webpack.config is generated by scalajs-bundler
module.exports = require('./scalajs.webpack.config');
module.exports.context = __dirname;
// Apply the bundler plugin for your sbt project name
angulate2ScalaJsBundler.apply('your-sbt-project-name', module);
// Then add this to build.sbt:
/*
npmDependencies in Compile += "@angular/common" -> "~2.4.0"
npmDependencies in Compile += "@angular/core" -> "~2.4.0"
npmDevDependencies in Compile += "angulate2-scalajs-bundler" -> "1.0.3"
webpackConfigFile in fastOptJS := Some(baseDirectory.value / "webpack.config.js")
*/
// Run: fastOptJS::webpack