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

58 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: 'eval-source-map',
target: 'web',
resolve: {
extensions: ['.ts', '.tsx', '.js', '.jsx']
},
2022-01-24 16:11:38 +01:00
externals: {
react: 'react',
reactDOM: 'react-dom',
reactIntl: 'react-intl',
},
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',
},
],
},
2022-01-24 16:11:38 +01:00
plugins: [
new CleanWebpackPlugin(),
new HtmlWebpackPlugin({
template: path.join(__dirname, 'index.html')
}),
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify('development')
})
],
devServer: {
contentBase: path.join(__dirname, 'dist'),
compress: true,
port: 9000,
hot: true,
}
}