mirror of
https://codeberg.org/demostf/inspector.git
synced 2026-06-03 10:04:09 +02:00
hot reload
This commit is contained in:
parent
8e4b5f9a61
commit
eb629acd5b
8 changed files with 11978 additions and 4825 deletions
|
|
@ -1,5 +1,9 @@
|
|||
const CopyWebpackPlugin = require("copy-webpack-plugin");
|
||||
const ReactRefreshWebpackPlugin = require('@pmmmwh/react-refresh-webpack-plugin');
|
||||
const path = require('path');
|
||||
const webpack = require('webpack');
|
||||
|
||||
const isDevelopment = process.env.NODE_ENV !== 'production';
|
||||
|
||||
module.exports = [{
|
||||
entry: "./bootstrap.js",
|
||||
|
|
@ -7,13 +11,27 @@ module.exports = [{
|
|||
path: path.resolve(__dirname, "dist"),
|
||||
filename: "bootstrap.js",
|
||||
},
|
||||
mode: "development",
|
||||
mode: isDevelopment ? 'development' : 'production',
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
test: /\.tsx?$/,
|
||||
use: 'ts-loader',
|
||||
test: /\.[jt]sx?$/,
|
||||
exclude: /node_modules/,
|
||||
use: [
|
||||
{
|
||||
loader: require.resolve('babel-loader'),
|
||||
options: {
|
||||
plugins: [
|
||||
isDevelopment && require.resolve('react-refresh/babel'),
|
||||
].filter(Boolean),
|
||||
},
|
||||
},
|
||||
'ts-loader',
|
||||
],
|
||||
},
|
||||
{
|
||||
test: /\.css$/i,
|
||||
use: ["style-loader", "css-loader", "postcss-loader"],
|
||||
},
|
||||
],
|
||||
},
|
||||
|
|
@ -21,8 +39,10 @@ module.exports = [{
|
|||
extensions: ['.tsx', '.ts', '.js'],
|
||||
},
|
||||
plugins: [
|
||||
new CopyWebpackPlugin({patterns: [{from: 'index.html'}]})
|
||||
],
|
||||
new CopyWebpackPlugin({patterns: [{from: 'index.html'}]}),
|
||||
isDevelopment && new webpack.HotModuleReplacementPlugin(),
|
||||
isDevelopment && new ReactRefreshWebpackPlugin(),
|
||||
].filter(Boolean),
|
||||
}, {
|
||||
entry: "./src/worker.ts",
|
||||
target: 'webworker',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue