Skip to content

Latest commit

 

History

History
81 lines (61 loc) · 1.9 KB

README.md

File metadata and controls

81 lines (61 loc) · 1.9 KB

fun-pack

A webpack plugin to use with scalajs projects.

This tool tries to detect if it is run with scalajs-bundler or not. If yes, it will use the generated webpack config from scalajs-bundler as a base and will add things on top. Otherwise, it will generate the whole webpack config. It should work equivalently and transparently.

Provides webpack configs for web development (dev and prod) and lambda development (dev and prod) and node executables (prod).

Usage

Install:

npm install @fun-stack/fun-pack

Use the following snippets as your webpack config.

Web

Web (dev):

const {webDev} = require("@fun-stack/fun-pack");

module.exports = webDev({
    // entrypoint: "entrypoint.js", // not needed with scalajs-bundler
    indexHtml: "src/main/html/index.html",
    // assetsDir: "assets",
    // extraStatic: [],
    // outputDir: "dev",
});

Web (prod):

const {webProd} = require("@fun-stack/fun-pack");

module.exports = webProd({
    // entrypoint: "entrypoint.js", // not needed with scalajs-bundler
    indexHtml: "src/main/html/index.html",
    // assetsDir: "assets",
    // outputDir: "dist",
});

Lambda

Lambda (dev):

const {lambdaDev} = require("@fun-stack/fun-pack");

module.exports = lambdaDev({
    // entrypoint: "entrypoint.js", // not needed with scalajs-bundler
    // assetsDir: "assets",
    // outputDir: "dev",
});

Lambda (prod):

const {lambdaProd} = require("@fun-stack/fun-pack");

module.exports = lambdaProd({
    // entrypoint: "entrypoint.js", // not needed with scalajs-bundler
    // assetsDir: "assets",
    // outputDir: "dist",

});

Node executable

Node executable (prod):

const {binProd} = require("@fun-stack/fun-pack");

module.exports = binProd({
    // entrypoint: "entrypoint.js", // not needed with scalajs-bundler
    // fileName: "output.js",
    // outputDir: "dist",
});