Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including ng2-webpack-config with all npm packages installed. Try it out:

var ng2WebpackConfig = require("ng2-webpack-config")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

ng2-webpack-config v0.0.5

Generic webpack config for Angular2 applications by @AngularClass

ng2-webpack-config npm version npm downloads

Just a few steps to steps to get up and running with angular2 and webpack

  1. Copy all js files from samples folder to your application root folder
  cp -rf node_modules/ng2-webpack-config/samples/* .
  cp -rf node_modules/ng2-webpack-config/samples/.ng2-config.js .
  1. Copy ts and .d.ts files to your angular2 app root folder ('./src' for example)
  cp -rf node_modules/ng2-webpack-config/samples/src/*.ts ./src
  1. Only 2 small steps left to get app and running:
  • Open .ng2-config.js and update some fields if needed
module.exports = {
  // metadata
  title: pkg.description,
  baseUrl: '/',
  // angular2 root folder name
  src: 'src',
  // dist folder name
  dist: 'dist',
  // entry html file
  htmlIndexes: ['index.html'],
  // karma bundle src
  spec: './spec-bundle.js',
  // webpack entry
  entry: {
    polyfills: './src/polyfills.ts',
    vendor: './src/vendor.ts',
    main: './src/index.ts'
  // in most cases you don't need to change this line
  commonChunks: {
    name: ['polyfills', 'vendor'].reverse()
  // webpack alias (just in case)
  alias: {},
  // copy any additional files you need
  copy: [
    {from: 'src/favicon.ico', to: 'favicon.ico'}
  • Open spec-bundle.js and update PATH_TO_FILES const

Now how to run it

  1. Webpack dev build, run: $ webpack
  2. Webpack prod build, run: $ NODE_ENV=production webpack
  3. Karma tests, run: $ karma start
  4. Protractor tests, run $ protractor
RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free