This commit is contained in:
Nathan Bierema 2023-09-16 18:20:43 -04:00
parent dc43f5270f
commit fddc75e530
7 changed files with 7 additions and 73 deletions

View File

@ -14,7 +14,7 @@ await esbuild.build({
define: {
'process.env.NODE_ENV': prod ? '"production"' : '"development"',
},
entryPoints: ['src/ReduxDevToolsApp.js'],
entryPoints: ['src/index.tsx'],
loader: {
'.woff2': 'dataurl',
},

View File

@ -87,6 +87,7 @@
"@types/socketcluster-client": "^16.0.0",
"@types/styled-components": "^5.1.26",
"@types/testing-library__jest-dom": "^5.14.9",
"@types/webpack-env": "^1.18.1",
"@typescript-eslint/eslint-plugin": "^6.5.0",
"@typescript-eslint/parser": "^6.5.0",
"babel-loader": "^9.1.3",

View File

@ -1 +0,0 @@
module.exports = require('./index').Root;

View File

@ -3,5 +3,5 @@
"compilerOptions": {
"types": ["node", "webpack-dev-server"]
},
"include": ["webpack.config.ts", "webpack.config.umd.ts"]
"include": ["webpack.config.ts"]
}

View File

@ -1,69 +0,0 @@
import * as path from 'path';
import * as webpack from 'webpack';
import ForkTsCheckerWebpackPlugin from 'fork-ts-checker-webpack-plugin';
export default (env: { production?: boolean } = {}): webpack.Configuration => ({
mode: env.production ? 'production' : 'development',
entry: {
app: ['./src/index'],
},
output: {
library: 'ReduxDevToolsApp',
libraryExport: 'Root',
libraryTarget: 'umd',
path: path.resolve(__dirname, 'umd'),
filename: env.production
? 'redux-devtools-app.min.js'
: 'redux-devtools-app.js',
},
module: {
rules: [
{
test: /\.(js|ts)x?$/,
loader: 'babel-loader',
exclude: /node_modules/,
},
{
test: /\.html$/,
loader: 'html-loader',
},
{
test: /\.css$/,
use: [{ loader: 'style-loader' }, { loader: 'css-loader' }],
},
{
test: /\.woff2$/,
type: 'asset/inline',
},
],
},
resolve: {
extensions: ['.js', '.jsx', '.ts', '.tsx'],
},
plugins: [
new webpack.DefinePlugin({
'process.env': {
PLATFORM: JSON.stringify('web'),
},
}),
new ForkTsCheckerWebpackPlugin({
typescript: {
configFile: 'tsconfig.json',
},
}),
],
externals: {
react: {
root: 'React',
commonjs2: 'react',
commonjs: 'react',
amd: 'react',
},
'react-dom': {
root: 'ReactDOM',
commonjs2: 'react-dom',
commonjs: 'react-dom',
amd: 'react-dom',
},
},
});

View File

@ -33,7 +33,7 @@
<script src="/port.js"></script>
<script>
const container = document.querySelector('#root');
const element = React.createElement(ReduxDevToolsApp, {
const element = React.createElement(ReduxDevToolsApp.Root, {
socketOptions: {
hostname: location.hostname,
port: reduxDevToolsPort,

View File

@ -1145,6 +1145,9 @@ importers:
'@types/testing-library__jest-dom':
specifier: ^5.14.9
version: 5.14.9
'@types/webpack-env':
specifier: ^1.18.1
version: 1.18.1
'@typescript-eslint/eslint-plugin':
specifier: ^6.5.0
version: 6.5.0(@typescript-eslint/parser@6.5.0)(eslint@8.48.0)(typescript@5.2.2)