Advertisement
stasgavrylov

Untitled

Apr 12th, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const path = require('path');
  2.  
  3. module.exports = {
  4.   entry: [
  5.     './src/index.js'
  6.   ],
  7.   module: {
  8.     rules: [
  9.       {
  10.         test: /\.(js|jsx)$/,
  11.         include: path.resolve(__dirname, "src"),
  12.         exclude: /node_modules/,
  13.         use: ['babel-loader']
  14.       },
  15.         {
  16.             test: /\.css$/,
  17.             use: [{
  18.                 loader: "style-loader" // creates style nodes from JS strings
  19.             }, {
  20.                 loader: "css-loader", // translates CSS into CommonJS
  21.             }]
  22.         },
  23.       {
  24.         test: /\.scss$/,
  25.         use: [{
  26.           loader: "style-loader" // creates style nodes from JS strings
  27.         }, {
  28.           loader: "css-loader" // translates CSS into CommonJS
  29.         }, {
  30.           loader: "sass-loader" // compiles Sass to CSS
  31.         }]
  32.       },
  33.       {
  34.         test: /\.svg$/,
  35.         loader: 'svg-url-loader'
  36.       }
  37.     ]
  38.   },
  39.   resolve: {
  40.     extensions: ['*', '.js', '.jsx'],
  41.     modules: [path.resolve(__dirname, 'src'), 'node_modules']
  42.   },
  43.   output: {
  44.     path: path.join(__dirname, './dist'),
  45.     filename: 'bundle.js',
  46.     libraryTarget: 'commonjs2',
  47.     publicPath: '/dist/',
  48.     umdNamedDefine: true
  49.   },
  50.   externals: {
  51.     // Don't bundle react or react-dom
  52.     react: {
  53.       commonjs: "react",
  54.       commonjs2: "react",
  55.       amd: "React",
  56.       root: "React"
  57.     },
  58.     "react-dom": {
  59.       commonjs: "react-dom",
  60.       commonjs2: "react-dom",
  61.       amd: "ReactDOM",
  62.       root: "ReactDOM"
  63.     }
  64.   },
  65.   devServer: {
  66.     contentBase: './dist'
  67.   }
  68. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement