wisemapping-frontend/packages/webcomponent/webpack.common.js

41 lines
1.0 KiB
JavaScript
Raw Normal View History

2021-09-07 22:31:46 +02:00
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
/** @type {import('webpack').Configuration} */
module.exports = {
entry: './src/index.tsx',
output: {
path: path.resolve(__dirname, 'lib'),
filename: 'webcomponent.js',
publicPath: '/',
},
module: {
rules: [
{
use: 'babel-loader',
test: /.(js|jsx)$/,
exclude: /node_modules/,
},
{
use: 'ts-loader',
test: /\.(ts|tsx)$/,
exclude: /node_modules/,
},
{
type: 'asset',
test: /\.(png|svg|jpg|jpeg|gif)$/i,
},
],
},
resolve: {
extensions: ['.ts', '.tsx', '.js', '.jsx', '.json'],
},
plugins: [
new CleanWebpackPlugin(),
new HtmlWebpackPlugin({
template: './public/index.html',
}),
],
};