const path = require('path');
const MiniCssExtractPlugin = require('mini-css-extract-plugin')
const CssMinimizerPlugin = require('css-minimizer-webpack-plugin');
module.exports = {
entry: {
'bundle.js': [
path.resolve(__dirname, 'src/index.js')
]
},
output: {
filename: '[name]',
path: path.resolve(__dirname, 'build'),
},
module: {
rules: [
{
test: /\.css$/,
use: [MiniCssExtractPlugin.loader, 'css-loader'],
},
{
test: /\.(woff|woff2|eot|ttf|svg)$/,
use: {loader: 'url-loader',},
}
],
},
optimization: {
minimize: true,
minimizer: [
new CssMinimizerPlugin({
minimizerOptions: {
preset: [
'default',
{
discardComments: { removeAll: true },
},
],
},
}),
],
},
plugins: [
new MiniCssExtractPlugin({
filename: 'style.min.css'
})
]
};
import './css/main.css';
import './css/codehilite.css';
import './css/light.css';
import './css/dark.css';
entry: {
'bundle.js': [
path.resolve(__dirname, 'src/index.js')
],
'light.js': [
path.resolve(__dirname, 'src/light.js')
],
'dark.js': [
path.resolve(__dirname, 'src/dark.js')
],
},