clientjs/packages/dashboard-components/webpack.config.js
author ymh <ymh.work@gmail.com>
Sat, 06 Jul 2019 01:11:34 +0200
changeset 17 c2c97df0a642
parent 11 37ecf0b9c174
permissions -rw-r--r--
Refresh packages and update version
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
5f4fcbc80b37 Create new repository to host all dashboard developments
ymh <ymh.work@gmail.com>
parents:
diff changeset
     1
const path = require('path');
5f4fcbc80b37 Create new repository to host all dashboard developments
ymh <ymh.work@gmail.com>
parents:
diff changeset
     2
// const nodeExternals = require('webpack-node-externals');
5f4fcbc80b37 Create new repository to host all dashboard developments
ymh <ymh.work@gmail.com>
parents:
diff changeset
     3
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
5f4fcbc80b37 Create new repository to host all dashboard developments
ymh <ymh.work@gmail.com>
parents:
diff changeset
     4
5f4fcbc80b37 Create new repository to host all dashboard developments
ymh <ymh.work@gmail.com>
parents:
diff changeset
     5
module.exports = {
6
819a7ab4e3fb aborted async loading test, better split dashboard-components
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
     6
  entry: {
819a7ab4e3fb aborted async loading test, better split dashboard-components
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
     7
    pages: path.resolve(__dirname, 'src/pages'),
819a7ab4e3fb aborted async loading test, better split dashboard-components
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
     8
    layouts: path.resolve(__dirname, 'src/layouts'),
819a7ab4e3fb aborted async loading test, better split dashboard-components
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
     9
    reducers: path.resolve(__dirname, 'src/reducers'),
819a7ab4e3fb aborted async loading test, better split dashboard-components
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    10
    ui: path.resolve(__dirname, 'src/ui'),
819a7ab4e3fb aborted async loading test, better split dashboard-components
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    11
    actions: path.resolve(__dirname, 'src/actions.js'),
11
37ecf0b9c174 Add Nextleap dashboard
ymh <ymh.work@gmail.com>
parents: 6
diff changeset
    12
    intl: path.resolve(__dirname, 'src/intl.jsx'),
6
819a7ab4e3fb aborted async loading test, better split dashboard-components
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    13
  },
819a7ab4e3fb aborted async loading test, better split dashboard-components
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    14
  // path.resolve(__dirname, 'src/index.js'),
0
5f4fcbc80b37 Create new repository to host all dashboard developments
ymh <ymh.work@gmail.com>
parents:
diff changeset
    15
  output: {
5f4fcbc80b37 Create new repository to host all dashboard developments
ymh <ymh.work@gmail.com>
parents:
diff changeset
    16
    path: path.resolve(__dirname, 'lib'),
6
819a7ab4e3fb aborted async loading test, better split dashboard-components
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    17
    // filename: 'dashboard-components.[name].js',
819a7ab4e3fb aborted async loading test, better split dashboard-components
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    18
    filename: '[name].js',
819a7ab4e3fb aborted async loading test, better split dashboard-components
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    19
    library: ['dashboard-components', '[name]'],
819a7ab4e3fb aborted async loading test, better split dashboard-components
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    20
    libraryTarget: 'umd',
0
5f4fcbc80b37 Create new repository to host all dashboard developments
ymh <ymh.work@gmail.com>
parents:
diff changeset
    21
  },
5f4fcbc80b37 Create new repository to host all dashboard developments
ymh <ymh.work@gmail.com>
parents:
diff changeset
    22
  resolve: {
5f4fcbc80b37 Create new repository to host all dashboard developments
ymh <ymh.work@gmail.com>
parents:
diff changeset
    23
    extensions: ['.wasm', '.mjs', '.js', '.json', '.jsx'],
5f4fcbc80b37 Create new repository to host all dashboard developments
ymh <ymh.work@gmail.com>
parents:
diff changeset
    24
  },
5f4fcbc80b37 Create new repository to host all dashboard developments
ymh <ymh.work@gmail.com>
parents:
diff changeset
    25
  // externals: [nodeExternals()],
5f4fcbc80b37 Create new repository to host all dashboard developments
ymh <ymh.work@gmail.com>
parents:
diff changeset
    26
  target: 'web',
5f4fcbc80b37 Create new repository to host all dashboard developments
ymh <ymh.work@gmail.com>
parents:
diff changeset
    27
  module: {
5f4fcbc80b37 Create new repository to host all dashboard developments
ymh <ymh.work@gmail.com>
parents:
diff changeset
    28
    rules: [
5f4fcbc80b37 Create new repository to host all dashboard developments
ymh <ymh.work@gmail.com>
parents:
diff changeset
    29
      {
5f4fcbc80b37 Create new repository to host all dashboard developments
ymh <ymh.work@gmail.com>
parents:
diff changeset
    30
        test: /\.(js|jsx)$/,
5f4fcbc80b37 Create new repository to host all dashboard developments
ymh <ymh.work@gmail.com>
parents:
diff changeset
    31
        enforce: 'pre',
5f4fcbc80b37 Create new repository to host all dashboard developments
ymh <ymh.work@gmail.com>
parents:
diff changeset
    32
        exclude: /node_modules/,
5f4fcbc80b37 Create new repository to host all dashboard developments
ymh <ymh.work@gmail.com>
parents:
diff changeset
    33
        loader: 'eslint-loader',
5f4fcbc80b37 Create new repository to host all dashboard developments
ymh <ymh.work@gmail.com>
parents:
diff changeset
    34
        options: {
5f4fcbc80b37 Create new repository to host all dashboard developments
ymh <ymh.work@gmail.com>
parents:
diff changeset
    35
          emitWarning: true,
5f4fcbc80b37 Create new repository to host all dashboard developments
ymh <ymh.work@gmail.com>
parents:
diff changeset
    36
          failOnWarning: true,
5f4fcbc80b37 Create new repository to host all dashboard developments
ymh <ymh.work@gmail.com>
parents:
diff changeset
    37
          failOnError: true,
5f4fcbc80b37 Create new repository to host all dashboard developments
ymh <ymh.work@gmail.com>
parents:
diff changeset
    38
        },
5f4fcbc80b37 Create new repository to host all dashboard developments
ymh <ymh.work@gmail.com>
parents:
diff changeset
    39
      },
5f4fcbc80b37 Create new repository to host all dashboard developments
ymh <ymh.work@gmail.com>
parents:
diff changeset
    40
      {
5f4fcbc80b37 Create new repository to host all dashboard developments
ymh <ymh.work@gmail.com>
parents:
diff changeset
    41
        test: /\.(js|jsx)$/,
5f4fcbc80b37 Create new repository to host all dashboard developments
ymh <ymh.work@gmail.com>
parents:
diff changeset
    42
        exclude: /node_modules/,
5f4fcbc80b37 Create new repository to host all dashboard developments
ymh <ymh.work@gmail.com>
parents:
diff changeset
    43
        loader: 'babel-loader',
5f4fcbc80b37 Create new repository to host all dashboard developments
ymh <ymh.work@gmail.com>
parents:
diff changeset
    44
        options: {
5f4fcbc80b37 Create new repository to host all dashboard developments
ymh <ymh.work@gmail.com>
parents:
diff changeset
    45
          presets: ['@babel/preset-env', '@babel/preset-react'],
5f4fcbc80b37 Create new repository to host all dashboard developments
ymh <ymh.work@gmail.com>
parents:
diff changeset
    46
          plugins: ['@babel/plugin-proposal-class-properties'],
5f4fcbc80b37 Create new repository to host all dashboard developments
ymh <ymh.work@gmail.com>
parents:
diff changeset
    47
        },
5f4fcbc80b37 Create new repository to host all dashboard developments
ymh <ymh.work@gmail.com>
parents:
diff changeset
    48
      },
5f4fcbc80b37 Create new repository to host all dashboard developments
ymh <ymh.work@gmail.com>
parents:
diff changeset
    49
      {
5f4fcbc80b37 Create new repository to host all dashboard developments
ymh <ymh.work@gmail.com>
parents:
diff changeset
    50
        test: /\.s[c|a]ss$/,
5f4fcbc80b37 Create new repository to host all dashboard developments
ymh <ymh.work@gmail.com>
parents:
diff changeset
    51
        use: ['style-loader', MiniCssExtractPlugin.loader, 'css-loader', 'postcss-loader', 'sass-loader'],
5f4fcbc80b37 Create new repository to host all dashboard developments
ymh <ymh.work@gmail.com>
parents:
diff changeset
    52
      },
5f4fcbc80b37 Create new repository to host all dashboard developments
ymh <ymh.work@gmail.com>
parents:
diff changeset
    53
      {
5f4fcbc80b37 Create new repository to host all dashboard developments
ymh <ymh.work@gmail.com>
parents:
diff changeset
    54
        test: /\.(png|jpg|gif)$/i,
5f4fcbc80b37 Create new repository to host all dashboard developments
ymh <ymh.work@gmail.com>
parents:
diff changeset
    55
        use: [
5f4fcbc80b37 Create new repository to host all dashboard developments
ymh <ymh.work@gmail.com>
parents:
diff changeset
    56
          {
5f4fcbc80b37 Create new repository to host all dashboard developments
ymh <ymh.work@gmail.com>
parents:
diff changeset
    57
            loader: 'url-loader',
5f4fcbc80b37 Create new repository to host all dashboard developments
ymh <ymh.work@gmail.com>
parents:
diff changeset
    58
            options: {
5f4fcbc80b37 Create new repository to host all dashboard developments
ymh <ymh.work@gmail.com>
parents:
diff changeset
    59
              limit: 8192,
5f4fcbc80b37 Create new repository to host all dashboard developments
ymh <ymh.work@gmail.com>
parents:
diff changeset
    60
            },
5f4fcbc80b37 Create new repository to host all dashboard developments
ymh <ymh.work@gmail.com>
parents:
diff changeset
    61
          },
5f4fcbc80b37 Create new repository to host all dashboard developments
ymh <ymh.work@gmail.com>
parents:
diff changeset
    62
        ],
5f4fcbc80b37 Create new repository to host all dashboard developments
ymh <ymh.work@gmail.com>
parents:
diff changeset
    63
      },
5f4fcbc80b37 Create new repository to host all dashboard developments
ymh <ymh.work@gmail.com>
parents:
diff changeset
    64
    ],
5f4fcbc80b37 Create new repository to host all dashboard developments
ymh <ymh.work@gmail.com>
parents:
diff changeset
    65
  },
5f4fcbc80b37 Create new repository to host all dashboard developments
ymh <ymh.work@gmail.com>
parents:
diff changeset
    66
  plugins: [
5f4fcbc80b37 Create new repository to host all dashboard developments
ymh <ymh.work@gmail.com>
parents:
diff changeset
    67
    new MiniCssExtractPlugin({
6
819a7ab4e3fb aborted async loading test, better split dashboard-components
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    68
      // filename: 'dashboard-components.[name].css',
819a7ab4e3fb aborted async loading test, better split dashboard-components
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    69
      filename: '[name].css',
0
5f4fcbc80b37 Create new repository to host all dashboard developments
ymh <ymh.work@gmail.com>
parents:
diff changeset
    70
    }),
5f4fcbc80b37 Create new repository to host all dashboard developments
ymh <ymh.work@gmail.com>
parents:
diff changeset
    71
  ],
5f4fcbc80b37 Create new repository to host all dashboard developments
ymh <ymh.work@gmail.com>
parents:
diff changeset
    72
  performance: {
5f4fcbc80b37 Create new repository to host all dashboard developments
ymh <ymh.work@gmail.com>
parents:
diff changeset
    73
    hints: false,
5f4fcbc80b37 Create new repository to host all dashboard developments
ymh <ymh.work@gmail.com>
parents:
diff changeset
    74
  },
5f4fcbc80b37 Create new repository to host all dashboard developments
ymh <ymh.work@gmail.com>
parents:
diff changeset
    75
};