mcf-use-example/webpack.common.js

45 lines
951 B
JavaScript
Raw Normal View History

2023-05-01 18:10:21 +01:00
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
module.exports = {
entry: './src/index.js',
output: {
filename: 'index.js',
path: path.resolve(__dirname, 'dist'),
// library: 'smartClientSocket',
// libraryTarget: 'umd'
},
plugins: [
new HtmlWebpackPlugin({
template: './src/index.html',
filename: path.resolve(__dirname, 'dist', 'index.html'),
}),
new MiniCssExtractPlugin({
filename: '[name].css',
chunkFilename: '[id].css',
}),
],
module: {
rules: [
{
test: /\.(js|jsx)$/,
exclude: /node_modules/,
use: {
loader: 'babel-loader',
},
},
{
test: /\.css$/,
use: [
{
loader: MiniCssExtractPlugin.loader,
},
'css-loader',
],
},
],
},
};