45 lines
951 B
JavaScript
45 lines
951 B
JavaScript
|
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',
|
||
|
],
|
||
|
},
|
||
|
],
|
||
|
},
|
||
|
|
||
|
};
|