webpack.dll.indexcss.config.js 1.04 KB
const path = require('path');
const shelljs = require('shelljs');
const {cssLoader} = require('./utils.js');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const config = require('../../package.json');
const distDir = path.join(__dirname, `../dist/${config.name}/${config.version}`);

// cope img font
shelljs.mkdir('-p', distDir);
shelljs.cp('-R', path.join(__dirname, '../img/'), distDir);
shelljs.cp('-R', path.join(__dirname, '../font/'), distDir);

let webpackConfig = {
    mode: 'production',
    entry: {
        index: [path.join(__dirname, '../scss/index.css')]
    },
    output: {
        path: path.join(__dirname, './dll'), // absolute path
        filename: '[name].js'
    },
    module: {
        rules: [{
            test: /\.css$/,
            use: cssLoader('pro', 'css')
        }]
    },
    stats: {
        children: false
    },
    performance: {
        maxEntrypointSize: 5120000,
        maxAssetSize: 5120000
    },
    plugins: [
        new ExtractTextPlugin('[name].css')
    ]
};

module.exports = webpackConfig;