fix(react-json-tree): fix react-json-tree examples (#531)

* Consolidate dependencies in react-json-tree examples

* Do it differently

* Update
This commit is contained in:
Nathan Bierema 2020-07-31 17:32:41 -04:00 committed by GitHub
parent 769d99a6c9
commit 0864f28156
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 18 additions and 45 deletions

View File

@ -28,7 +28,8 @@
"test:all": "jest"
},
"workspaces": [
"packages/*"
"packages/*",
"packages/react-json-tree/examples"
],
"engines": {
"node": ">=8.0.0"

9
packages/react-json-tree/examples/.babelrc Executable file → Normal file
View File

@ -1,9 +1,4 @@
{
"plugins": [
"transform-object-rest-spread",
"transform-class-properties"
],
"presets": [
"env", "react"
]
"presets": ["@babel/preset-env", "@babel/preset-react"],
"plugins": ["@babel/plugin-proposal-class-properties"]
}

View File

@ -27,18 +27,19 @@
},
"homepage": "https://github.com/gaearon/react-hot-boilerplate",
"devDependencies": {
"babel-core": "^6.26.0",
"babel-loader": "^7.1.2",
"babel-plugin-transform-class-properties": "^6.24.1",
"babel-plugin-transform-object-rest-spread": "^6.26.0",
"babel-preset-react": "^6.5.0",
"webpack": "^3.8.1",
"webpack-dev-server": "^3.10.3"
"@babel/core": "^7.2.2",
"@babel/plugin-proposal-class-properties": "^7.3.0",
"@babel/preset-env": "^7.3.1",
"@babel/preset-react": "^7.0.0",
"babel-loader": "^8.0.5",
"webpack": "^4.27.1",
"webpack-dev-server": "^3.1.14"
},
"dependencies": {
"immutable": "^3.8.1",
"react": "^16.0.0",
"react-base16-styling": "^0.5.3",
"react-dom": "^16.0.0"
"react-dom": "^16.0.0",
"react-json-tree": "^0.12.0"
}
}

View File

@ -1,6 +1,6 @@
import React from 'react';
import { Map } from 'immutable';
import JSONTree from '../../src';
import JSONTree from 'react-json-tree';
const getLabelStyle = ({ style }, nodeType, expanded) => ({
style: {

View File

@ -4,6 +4,7 @@ var webpack = require('webpack');
var isProduction = process.env.NODE_ENV === 'production';
module.exports = {
mode: isProduction ? 'production' : 'development',
devtool: 'source-map',
entry: [
!isProduction && 'webpack-dev-server/client?http://localhost:3000',
@ -16,39 +17,14 @@ module.exports = {
publicPath: '/static/'
},
plugins: [
new webpack.DefinePlugin({
'process.env': {
NODE_ENV: JSON.stringify(process.env.NODE_ENV)
}
}),
new webpack.HotModuleReplacementPlugin(),
new webpack.NoEmitOnErrorsPlugin(),
isProduction &&
new webpack.optimize.UglifyJsPlugin({
compress: { warnings: false },
output: { comments: false },
sourceMap: true
})
].filter(Boolean),
resolve: {
alias: {
'react-json-tree/lib': path.join(__dirname, '..', 'src'),
'react-json-tree': path.join(__dirname, '..', 'src'),
react: path.join(__dirname, 'node_modules', 'react')
},
extensions: ['.js']
},
],
module: {
loaders: [
rules: [
{
test: /\.js$/,
loaders: ['babel-loader'].filter(Boolean),
loader: 'babel-loader',
include: path.join(__dirname, 'src')
},
{
test: /\.js$/,
loaders: ['babel-loader'].filter(Boolean),
include: path.join(__dirname, '..', 'src')
}
]
}