Advertisement
Guest User

webpack config example

a guest
May 8th, 2017
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const webpack = require("webpack");
  2. const path = require("path");
  3.  
  4. module.exports = {
  5.     entry: {
  6.         index: "vents",
  7.         vendor: [
  8.             "canvasjs",
  9.             "babel-polyfill",
  10.             "react",
  11.             "react-dom",
  12.             "redux",
  13.             "react-redux",
  14.             "react-tap-event-plugin",
  15.             "material-ui",
  16.             "redux-form",
  17.             "redux-thunk",
  18.             "prop-types",
  19.             "whatwg-fetch",
  20.             "reselect",
  21.             "re-reselect"
  22.         ]
  23.     },
  24.     output: {
  25.         path: path.resolve("bin"),
  26.         publicPath: "/js/bin/",
  27.         filename: "[name].js"
  28.     },
  29.     module: {
  30.         rules: [
  31.             {
  32.                 test: /\.js$/,
  33.                 exclude: /node_modules/,
  34.                 loader: "babel-loader"
  35.             },
  36.             {
  37.                 test: /canvasjs\.min\.js$/,
  38.                 loader: "exports-loader?CanvasJS"
  39.             }
  40.         ]
  41.     },
  42.     plugins: [
  43.         new webpack.optimize.CommonsChunkPlugin({
  44.             names: [
  45.                 "vendor",
  46.                 "manifest"
  47.             ]
  48.         })
  49.     ],
  50.     resolve: {
  51.         alias: {
  52.             components: path.resolve("src", "components"),
  53.             containers: path.resolve("src", "containers"),
  54.             actions: path.resolve("src", "actions"),
  55.             reducers: path.resolve("src", "reducers"),
  56.             selectors: path.resolve("src", "selectors"),
  57.             canvasjs: "canvasjs.min.js"
  58.         },
  59.         modules: [
  60.             __dirname,
  61.             "src",
  62.             "node_modules"
  63.         ]
  64.     }
  65. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement