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

55 lines
1.2 KiB
JavaScript
Raw Normal View History

const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const webpack = require('webpack');
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
module.exports = {
2022-01-24 16:11:38 +01:00
output: {
filename: 'editor.bundle.js',
path: path.resolve(__dirname, 'dist'),
library: {
type: 'umd',
},
},
entry: {
2022-01-24 16:11:38 +01:00
editor: path.join(__dirname, 'src', 'index.tsx')
},
2022-01-24 16:11:38 +01:00
mode: 'development',
devtool: 'source-map',
target: 'web',
resolve: {
extensions: ['.ts', '.tsx', '.js', '.jsx']
},
module: {
rules: [
{
test: /\.tsx?$/,
use: 'ts-loader',
exclude: '/node_modules/'
2022-01-24 16:11:38 +01:00
},
{
test: /\.(png|jpe?g|gif|svg)$/,
type: 'asset/inline',
},
{
test: /\.(js|jsx)$/,
exclude: /node_modules/,
use: ['babel-loader'],
},
],
},
2022-01-24 16:11:38 +01:00
plugins: [
new CleanWebpackPlugin(),
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify('development')
})
],
devServer: {
contentBase: path.join(__dirname, 'dist'),
compress: true,
port: 9000,
hot: true,
}
}