123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- const path = require('path')
- const MiniCssExtractPlugin = require('mini-css-extract-plugin')
- const HtmlWebpackPlugin = require('html-webpack-plugin')
- const projectPath = path.resolve(__dirname, '../')
- module.exports = {
- mode: 'production',
- entry: {
- index: './src/app.js',
- vendor: ['react', 'react-dom', 'prop-types', 'classnames'],
- },
- output: {
- path: path.resolve(__dirname, '../dist'),
- filename: '[name]-bundle-[hash:8].js',
- },
- module: {
- rules: [
- {
- test: /\.js$/,
- loader: 'babel-loader',
- exclude: /node_modules/,
- },
- {
- test: /\.css$/,
- use: [
- {
- loader: MiniCssExtractPlugin.loader,
- options: {
- publicPath: './',
- },
- },
- {
- loader: 'css-loader',
- options: {
- modules: true,
- camelCase: true,
- localIdentName: '[name]__[local]--[hash:base64:5]',
- },
- },
- 'postcss-loader',
- ],
- },
- {
- test: /\.(jpe?g|png|svg|bmp)$/,
- loader: 'file-loader',
- options: {
- outputPath: 'images/',
- name: '[name]-[hash:base64:5].[ext]',
- },
- },
- ],
- },
- plugins: [
- new MiniCssExtractPlugin({
- filename: '[name].[hash].css',
- chunkFilename: '[id].[hash].css',
- }),
- new HtmlWebpackPlugin({
- title: 'Datepicker',
- filename: 'index.html',
- template: path.resolve(projectPath, 'index.html'),
- inject: false,
- }),
- ],
- }
|