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" "test:all": "jest"
}, },
"workspaces": [ "workspaces": [
"packages/*" "packages/*",
"packages/react-json-tree/examples"
], ],
"engines": { "engines": {
"node": ">=8.0.0" "node": ">=8.0.0"

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

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

View File

@ -27,18 +27,19 @@
}, },
"homepage": "https://github.com/gaearon/react-hot-boilerplate", "homepage": "https://github.com/gaearon/react-hot-boilerplate",
"devDependencies": { "devDependencies": {
"babel-core": "^6.26.0", "@babel/core": "^7.2.2",
"babel-loader": "^7.1.2", "@babel/plugin-proposal-class-properties": "^7.3.0",
"babel-plugin-transform-class-properties": "^6.24.1", "@babel/preset-env": "^7.3.1",
"babel-plugin-transform-object-rest-spread": "^6.26.0", "@babel/preset-react": "^7.0.0",
"babel-preset-react": "^6.5.0", "babel-loader": "^8.0.5",
"webpack": "^3.8.1", "webpack": "^4.27.1",
"webpack-dev-server": "^3.10.3" "webpack-dev-server": "^3.1.14"
}, },
"dependencies": { "dependencies": {
"immutable": "^3.8.1", "immutable": "^3.8.1",
"react": "^16.0.0", "react": "^16.0.0",
"react-base16-styling": "^0.5.3", "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 React from 'react';
import { Map } from 'immutable'; import { Map } from 'immutable';
import JSONTree from '../../src'; import JSONTree from 'react-json-tree';
const getLabelStyle = ({ style }, nodeType, expanded) => ({ const getLabelStyle = ({ style }, nodeType, expanded) => ({
style: { style: {

View File

@ -4,6 +4,7 @@ var webpack = require('webpack');
var isProduction = process.env.NODE_ENV === 'production'; var isProduction = process.env.NODE_ENV === 'production';
module.exports = { module.exports = {
mode: isProduction ? 'production' : 'development',
devtool: 'source-map', devtool: 'source-map',
entry: [ entry: [
!isProduction && 'webpack-dev-server/client?http://localhost:3000', !isProduction && 'webpack-dev-server/client?http://localhost:3000',
@ -16,39 +17,14 @@ module.exports = {
publicPath: '/static/' publicPath: '/static/'
}, },
plugins: [ plugins: [
new webpack.DefinePlugin({
'process.env': {
NODE_ENV: JSON.stringify(process.env.NODE_ENV)
}
}),
new webpack.HotModuleReplacementPlugin(), 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: { module: {
loaders: [ rules: [
{ {
test: /\.js$/, test: /\.js$/,
loaders: ['babel-loader'].filter(Boolean), loader: 'babel-loader',
include: path.join(__dirname, 'src') include: path.join(__dirname, 'src')
},
{
test: /\.js$/,
loaders: ['babel-loader'].filter(Boolean),
include: path.join(__dirname, '..', 'src')
} }
] ]
} }