Skip to content

Build options: Webpack

Andrew Koltyakov edited this page Oct 4, 2017 · 3 revisions

sp-build-tasks uses Webpack for packing scripts.

TypeScript, ES vNext or vanilla JavaScript can be used as script sources by default.

Webpack settings can be defined in ./webpack.config.js in a usual for Webpack way. There is a built-in configuration and settings layer. Webpack build process can be tweaked in ./config/app.json within the following parameters:

{
  ...
  // webpackItemsMap: Array or entry/target script pairs
  "webpackItemsMap": [{
    "entry": "./src/scripts/scriptName.ts",
      // Relative path to .ts, .js file within the project's folder structure
    "target": "scriptName.js", 
      // Relative path to output bundle script within `./dist/stripts` folder
    "webpackConfig": {} 
      // Optional Webpack configuration which is added 
      // to webpack's configs for a specific entry point 
  }],
  "webpackConfig": {},
    // Optional Webpack configuration which is added 
    // to webpack's configs for all entry points
  ...
}