hellsgate

WebpackKarma - Webpack config

Sep 6th, 2016
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ;(function() {
  2.   'use strict';
  3.   console.log('Webpack config');
  4.   const webpack = require('webpack');
  5.   const path = require('path');
  6.   const autoprefixer = require('autoprefixer');
  7.  
  8.   const APP = __dirname + '/app';
  9.  
  10.   module.exports = {
  11.     context: APP,
  12.     entry: {
  13.       app: ['webpack/hot/dev-server', './core/bootstrap.js',],
  14.     },
  15.     output: {
  16.       path: APP,
  17.       filename: 'bundle.js',
  18.     },
  19.     module: {
  20.       loaders: [
  21.         {
  22.           test: /\.html$/,
  23.           loader: 'raw',
  24.         },
  25.         {
  26.           test: /\.(jpe?g|png|gif|svg)$/i,
  27.           loaders: [
  28.             'file?hash=sha512&digest=hex&name=img/[path][hash].[ext]',
  29.             'image-webpack',
  30.           ],
  31.         },
  32.         {
  33.           test: /\.scss$/,
  34.           loader: 'style!css!postcss!sass!sass-resources!scsslint',
  35.         },
  36.         {
  37.           test: /\.js$/,
  38.           loader: 'ng-annotate!babel!eslint',
  39.           exclude: /node_modules/,
  40.         },
  41.       ],
  42.     },
  43.     postcss() {
  44.       return [autoprefixer,];
  45.     },
  46.     // The following config parameter allows us to import all the .scss files from our
  47.     // components without having to manually import them in main.scss
  48.     sassResources: path.resolve(__dirname, './app/components/**/*.scss'),
  49.     imageWebpackLoader: {
  50.       pngquant: {
  51.         quality: "65-90",
  52.         speed: 4,
  53.       },
  54.       svgo: {
  55.         plugins: [
  56.           {
  57.             removeViewBox: false,
  58.           },
  59.           {
  60.             removeEmptyAttrs: false,
  61.           },
  62.         ],
  63.       },
  64.     },
  65.     plugins: [
  66.       new webpack.optimize.UglifyJsPlugin({
  67.         minimize: true,
  68.         output: {
  69.           comments: false,
  70.         },
  71.         compressor: {
  72.           warnings: false,
  73.         },
  74.       }),
  75.     ],
  76.   };
  77. }());
Advertisement
Add Comment
Please, Sign In to add comment