Advertisement
lswest

webpack.config.js

Apr 8th, 2017
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. "use strict";
  2.  
  3. var path = require("path");
  4. var Webpack = require("webpack");
  5. var ExtractTextPlugin = require("extract-text-webpack-plugin");
  6. var rupture = require('rupture');
  7.  
  8. // Our configuration
  9. module.exports = {
  10.  
  11.     // Define the entry point
  12.     context: __dirname + "/source/styles",
  13.     entry: "./styles.js",
  14.  
  15.     // Output configuration
  16.     output: {
  17.         path: path.resolve(__dirname, "dist"),
  18.         filename: "[name].js",
  19.     },
  20.  
  21.     module: {
  22.         rules: [
  23.             // Inform CSS modules must be bundled in another file.
  24.             {
  25.                 test: /\.css$/,
  26.                 use: ExtractTextPlugin.extract({
  27.                     fallback: 'style-loader',
  28.                     use: [
  29.                         {
  30.                             loader: 'css-loader',
  31.                             options: {
  32.                                 importLoaders: 1
  33.                             }
  34.                         },
  35.                         'postcss-loader'
  36.                     ]
  37.                 })
  38.             },
  39.             {
  40.                 test: /\.styl$/,
  41.                 use: ExtractTextPlugin.extract({
  42.                     fallback: 'style-loader',
  43.                     use: [
  44.                         {
  45.                             loader: 'css-loader',
  46.                             options: {
  47.                                 importLoaders: 1
  48.                             }
  49.                         },
  50.                         'postcss-loader',
  51.                         {
  52.                             loader: 'stylus-loader',
  53.                             options: {
  54.                                 use: [rupture()],
  55.                             }
  56.                         }
  57.                     ]
  58.                 })
  59.             },
  60.             {
  61.                 test: /\.woff(2)?(\?v=[0-9]\.[0-9]\.[0-9])?$/,
  62.                 use: "url-loader?limit=10000&mimetype=application/font-woff"
  63.             },
  64.             {
  65.                 test: /\.(ttf|eot|svg)(\?v=[0-9]\.[0-9]\.[0-9])?$/,
  66.                 use: "file-loader"
  67.             }
  68.         ]
  69.     },
  70.  
  71.     plugins: [
  72.         // Extract all CSS content to a file
  73.         new ExtractTextPlugin("[name].css")
  74.     ]
  75.  
  76. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement