chore(d3-state-visualizer): fix example build (#875)

This commit is contained in:
Nathan Bierema 2021-09-19 20:33:29 -04:00 committed by GitHub
parent f454ac8a7f
commit f23b14cdf0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 43 additions and 23 deletions

View File

@ -34,6 +34,5 @@
</head> </head>
<body> <body>
<div id="root"></div> <div id="root"></div>
<script src="/static/bundle.js"></script>
</body> </body>
</html> </html>

View File

@ -13,22 +13,27 @@
"url": "https://github.com/reduxjs/redux-devtools/issues" "url": "https://github.com/reduxjs/redux-devtools/issues"
}, },
"license": "MIT", "license": "MIT",
"scripts": {
"start": "webpack serve --open"
},
"repository": { "repository": {
"type": "git", "type": "git",
"url": "https://github.com/reduxjs/redux-devtools.git" "url": "https://github.com/reduxjs/redux-devtools.git"
}, },
"scripts": {
"start": "webpack serve --open"
},
"dependencies": { "dependencies": {
"d3-state-visualizer": "^1.4.0", "d3-state-visualizer": "^1.4.0",
"map2tree": "^1.5.0" "map2tree": "^1.5.0"
}, },
"devDependencies": { "devDependencies": {
"@babel/core": "^7.15.5",
"@babel/preset-env": "^7.15.6",
"@babel/preset-typescript": "^7.15.0",
"@types/node": "^14.17.15", "@types/node": "^14.17.15",
"@types/webpack": "^5.28.0", "@types/webpack": "^5.28.0",
"@types/webpack-dev-server": "^4.1.0", "@types/webpack-dev-server": "^4.1.0",
"babel-loader": "^8.2.2", "babel-loader": "^8.2.2",
"fork-ts-checker-webpack-plugin": "^6.3.3",
"html-webpack-plugin": "^5.3.2",
"ts-node": "^10.2.1", "ts-node": "^10.2.1",
"typescript": "~4.3.5", "typescript": "~4.3.5",
"webpack": "^5.52.1", "webpack": "^5.52.1",

View File

@ -20,7 +20,7 @@ const appState = {
}, },
}; };
const render = tree(document.getElementById('root'), { const render = tree(document.getElementById('root')!, {
state: appState, state: appState,
id: 'treeExample', id: 'treeExample',
size: 1000, size: 1000,

View File

@ -0,0 +1,4 @@
{
"extends": "../../../../tsconfig.base.json",
"include": ["src"]
}

View File

@ -1,36 +1,43 @@
import * as path from 'path'; import * as path from 'path';
import * as webpack from 'webpack'; import HtmlWebpackPlugin from 'html-webpack-plugin';
import ForkTsCheckerWebpackPlugin from 'fork-ts-checker-webpack-plugin';
export default { export default {
mode: process.env.NODE_ENV === 'production' ? 'production' : 'development', mode: 'development',
entry: [ entry: './src/index.ts',
'webpack-dev-server/client?http://localhost:3000', devtool: 'eval-source-map',
'webpack/hot/only-dev-server', devServer: {
'./index', static: './dist',
},
plugins: [
new HtmlWebpackPlugin({
template: './index.html',
}),
new ForkTsCheckerWebpackPlugin(),
], ],
output: { output: {
path: path.join(__dirname, 'dist'),
filename: 'bundle.js', filename: 'bundle.js',
publicPath: '/static/', path: path.join(__dirname, 'dist'),
clean: true,
}, },
module: { module: {
rules: [ rules: [
{ {
test: /\.(js|ts)$/, test: /\.(js|ts)$/,
loader: 'babel-loader',
exclude: /node_modules/, exclude: /node_modules/,
include: __dirname, use: {
loader: 'babel-loader',
options: {
presets: [
['@babel/preset-env', { targets: 'defaults' }],
'@babel/preset-typescript',
],
},
},
}, },
], ],
}, },
resolve: { resolve: {
extensions: ['.js', '.jsx', '.ts', '.tsx'], extensions: ['.js', '.jsx', '.ts', '.tsx'],
}, },
plugins: [new webpack.HotModuleReplacementPlugin()],
devServer: {
historyApiFallback: true,
hot: true,
port: 3000,
},
devtool: 'eval-source-map',
}; };

View File

@ -1,5 +1,5 @@
{ {
"extends": "../../tsconfig.react.base.json", "extends": "../../tsconfig.base.json",
"compilerOptions": { "compilerOptions": {
"outDir": "lib" "outDir": "lib"
}, },

View File

@ -12414,11 +12414,16 @@ __metadata:
version: 0.0.0-use.local version: 0.0.0-use.local
resolution: "d3-state-visualizer-tree-example@workspace:packages/d3-state-visualizer/examples/tree" resolution: "d3-state-visualizer-tree-example@workspace:packages/d3-state-visualizer/examples/tree"
dependencies: dependencies:
"@babel/core": ^7.15.5
"@babel/preset-env": ^7.15.6
"@babel/preset-typescript": ^7.15.0
"@types/node": ^14.17.15 "@types/node": ^14.17.15
"@types/webpack": ^5.28.0 "@types/webpack": ^5.28.0
"@types/webpack-dev-server": ^4.1.0 "@types/webpack-dev-server": ^4.1.0
babel-loader: ^8.2.2 babel-loader: ^8.2.2
d3-state-visualizer: ^1.4.0 d3-state-visualizer: ^1.4.0
fork-ts-checker-webpack-plugin: ^6.3.3
html-webpack-plugin: ^5.3.2
map2tree: ^1.5.0 map2tree: ^1.5.0
ts-node: ^10.2.1 ts-node: ^10.2.1
typescript: ~4.3.5 typescript: ~4.3.5