Skip to content

configuration

benholloway edited this page Mar 14, 2016 · 7 revisions
/* global process:true */

var angularity = require('webpack-angularity-solution');

const PORT    = 55555,
      GLOBALS = {
        $              : 'jquery',
        jQuery         : 'jquery',
        'window.jQuery': 'jquery'
      };

module.exports = angularity({globals: GLOBALS, port: PORT}, process.env)
  .include(process.env.MODE) // app|test|release
  .otherwise('app_test')	 // run app+test if MODE is unspecified
  .resolve();

Some explanation:

  • Option globals

    Note that there are no globals in applications bundled by Webpack. If your code relies on globals such as jQuery, you will have to configure the globals option as shown above.

    Add additional globals as required by your application.

    Better practice may be to solve the problem at its source using module Shimming (see Shimming below).

  • Option port

    By default --watch in the app mode will launch a BrowserSync server on port 55555. You should override this port to some unique value so that your projects to no conflict with each other.

  • Options by process.env

    More than one configuration may be passed to angularity(). This means process.env may be passed in entirity (See environment variables below).

  • The include() and otherwise() methods

    The include() statement runs either of the defined app|test|release compilations where the MODE environment variable.

    Omission of MODE implies the otherwise() behavior, where both app and test compilations will run. You should customise this default behavior to your taste.

    The test mode is only meaningful if you have *.spec.js files in your project.

Clone this wiki locally