webpack.dll.config.js 1.8 KB
import path from 'path';
import webpack from 'webpack';
import HtmlWebpackPlugin from 'html-webpack-plugin';

const rootPath = path.resolve(__dirname, '..');

const vendor = [
    "classnames",
    "connected-react-router",
    "es6-promise",
    "history",
    "isomorphic-fetch",
    "localforage",
    "plupload",
    "rc-animate",
    "react",
    "react-dom",
    "react-loadable",
    "react-redux",
    "react-router",
    "react-router-dom",
    "reduce-reducers",
    "redux",
    "redux-form",
    "redux-saga"
];


module.exports = {
    entry: {
        vendor: vendor
    },
    output: {
        path: path.resolve(rootPath, 'temp_build'),
        filename: '[name].[chunkhash].js',
        library: '[name]_[chunkhash]',
        publicPath: '/'
    },
    cache: true,
    mode: 'production',
    stats: {
        assets: true,
        assetsSort: 'chunks',
        children: false,
        colors: true,
        reasons: false,
        hash: false,
        env: true,
        version: true,
        timings: true,
        chunks: false,
        chunkGroups: false,
        chunkModules: false,
        chunkOrigins: false,
        modules: false,
        cached: false,
        moduleTrace: false,
        performance: true,
        warnings: false,
        cachedAssets: false
    },
    plugins: [
        new webpack.DllPlugin({
            path: path.resolve(rootPath, 'temp_build', '[name].manifest.json'),
            name: '[name]_[chunkhash]'
        }),
        new HtmlWebpackPlugin({
            "title": 'Custom template',
            "csrfToken": '<%=htmlWebpackPlugin.options.csrfToken%>',
            "filename": path.resolve(rootPath, 'temp_build', 'index-production.html'),
            "inject": 'head',
            "template": path.resolve(rootPath, 'src', 'index-template.html')
        })
    ]
};