12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- 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: './src/index.js',
- output: {
- path: path.resolve(__dirname, '../dist'),
- filename: '[name]-bundle-[hash:8].js',
- },
- module: {
- rules: [
- {
- test: /\.js$/,
- loader: 'babel-loader',
- include: path.resolve(projectPath, 'src'),
- exclude: /node_modules/,
- },
- {
- test: /\.css$/,
- use: [
- {
- loader: MiniCssExtractPlugin.loader,
- options: {
- publicPath: '../dist/styles',
- },
- },
- {
- loader: 'css-loader',
- options: {
- modules: true,
- camelCase: true,
- localIdentName: '[name]__[local]--[hash:base64:5]',
- },
- },
- ],
- },
- ],
- },
- plugins: [
- new MiniCssExtractPlugin({
- filename: '[name].css',
- chunkFilename: '[id].css',
- }),
- new HtmlWebpackPlugin({
- title: 'Datepicker',
- filename: 'index.html',
- template: path.resolve(projectPath, 'index.html'),
- inject: false,
- }),
- ],
- }
|