Guest User

Webpack config

a guest
Dec 18th, 2015
1,349
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var path = require('path');
  2.  
  3. var autoprefixer = require('autoprefixer-core');
  4. var cssnext = require('cssnext');
  5. var doiuse = require('doiuse');
  6. var colors = require('colors');
  7. var wordwrap = require('wordwrap');
  8. var csswring = require('csswring');
  9. var nested = require('postcss-nested');
  10. var WebpackNotifierPlugin = require('webpack-notifier');
  11.  
  12. module.exports = {
  13.     debug: 'true',
  14.     devtool: 'source-map',
  15.  
  16.     entry: {
  17.         app: ['./src/ts/app.ts']
  18.     },
  19.     output: {
  20.         path: require('path').resolve('build'),
  21.         publicPath: '/',
  22.         filename: 'bundle.js'
  23.     },
  24.     resolve: {
  25.       extensions: ['', '.webpack.js', '.web.js', '.ts', '.js']
  26.     },
  27.     module: {
  28.         postLoaders: [
  29.             {
  30.               loader: "transform?brfs"
  31.             }
  32.         ],
  33.  
  34.         loaders: [
  35.             {
  36.                 test: /\.css$/,
  37.                 loader: 'style-loader!css-loader!postcss-loader'
  38.             },
  39.             {
  40.                 test: /\.js$/,
  41.                 exclude: /node_modules/,
  42.                 loader: 'babel-loader'
  43.             },
  44.             {
  45.               test: /\.ts$/,
  46.               exclude: /node_modules/,
  47.               loader: 'ts-loader'
  48.             },
  49.             {
  50.                 test: /\.json$/,
  51.                 include: path.join(__dirname, 'node_modules', 'pixi.js'),
  52.                 loader: 'json'
  53.             },
  54.             {
  55.                 test: /\.json$/,
  56.                 include: path.join(__dirname, 'node_modules', 'filesaver.js'),
  57.                 loader: 'json'
  58.             }
  59.         ]
  60.     },
  61.     postcss: [
  62.         nested,
  63.         cssnext,
  64.         doiuse({
  65.             onFeatureUsage: function(info) {
  66.                 var source = info.usage.source;
  67.                 // file is whole require path, joined with !'s.. we want the last part
  68.                 var sourceFile = path.relative('.', source.input.file.split('!').pop())
  69.                 var sourceLine = sourceFile + ':' + source.start.line;
  70.                 // take out location info in message itself
  71.                 var message = info.message.split(': ').slice(1).join(': ')
  72.                 console.log('[doiuse]'.red + ' ' + sourceLine + ': ' + info.featureData.title + '\n');
  73.                 console.log(wordwrap(4, process.stdout.columns - 1)(message) + '\n');
  74.             }
  75.         }),
  76.         autoprefixer,
  77.         csswring
  78.     ],
  79.  
  80.     plugins: [
  81.         new WebpackNotifierPlugin({title: 'Webpack'})
  82.     ]
  83. };
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×