2020-12-05 08:47:02 +01:00
|
|
|
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',
|
|
|
|
},
|
|
|
|
},
|
2020-12-05 08:47:02 +01:00
|
|
|
entry: {
|
2022-01-24 16:11:38 +01:00
|
|
|
editor: path.join(__dirname, 'src', 'index.tsx')
|
2020-12-05 08:47:02 +01:00
|
|
|
},
|
2022-01-24 16:11:38 +01:00
|
|
|
mode: 'development',
|
2022-01-24 21:22:39 +01:00
|
|
|
devtool: 'source-map',
|
2020-12-05 08:47:02 +01:00
|
|
|
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',
|
|
|
|
},
|
2022-01-24 21:22:39 +01:00
|
|
|
{
|
|
|
|
test: /\.(js|jsx)$/,
|
|
|
|
exclude: /node_modules/,
|
|
|
|
use: ['babel-loader'],
|
|
|
|
},
|
2020-12-05 08:47:02 +01:00
|
|
|
],
|
|
|
|
},
|
2022-01-24 16:11:38 +01:00
|
|
|
|
2020-12-05 08:47:02 +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,
|
|
|
|
}
|
|
|
|
}
|