Skip to content

Commit c178539

Browse files
authored
[Bug] Fix build (#19)
* add babel plugin to render correct package.json version * --max_old_space_size=4096 to biuld script Signed-off-by: Shan He <[email protected]>
1 parent f68713e commit c178539

File tree

4 files changed

+27
-12
lines changed

4 files changed

+27
-12
lines changed

.babelrc

Lines changed: 0 additions & 7 deletions
This file was deleted.

config-overrides.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
const {addBabelPlugin, override} = require('customize-cra');
2+
const packageJSON = require('./package');
3+
4+
module.exports = override(
5+
addBabelPlugin([
6+
'search-and-replace',
7+
{
8+
rules: [
9+
{
10+
search: '__PACKAGE_VERSION__',
11+
replace: packageJSON.version
12+
}
13+
]
14+
}
15+
])
16+
);

package.json

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,19 +51,22 @@
5151
"url-parse": "^1.4.3"
5252
},
5353
"devDependencies": {
54+
"babel-plugin-search-and-replace": "^1.0.0",
55+
"customize-cra": "^0.9.1",
5456
"eslint-config-prettier": "^3.6.0",
5557
"eslint-config-uber-es2015": "^3.1.2",
5658
"eslint-config-uber-jsx": "^3.3.3",
5759
"eslint-plugin-babel": "^5.3.0",
5860
"eslint-plugin-prettier": "^3.0.1",
59-
"eslint-plugin-react": "~7.12.4"
61+
"eslint-plugin-react": "~7.12.4",
62+
"react-app-rewired": "^2.1.5"
6063
},
6164
"scripts": {
6265
"predeploy": "npm run build",
6366
"deploy": "gh-pages -d build",
64-
"start": "react-scripts start",
65-
"build": "react-scripts build",
66-
"test": "react-scripts test --env=jsdom",
67+
"start": "react-app-rewired start",
68+
"build": "react-app-rewired --max_old_space_size=4096 build",
69+
"test": "react-app-rewired test --env=jsdom",
6770
"eject": "react-scripts eject"
6871
},
6972
"browserslist": [

src/components/KeplerGL/index.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ import CustomSidebarFactory from './components/side-bar';
3838
// Kepler.gl Schema APIs
3939
import KeplerGlSchema from 'kepler.gl/schemas';
4040

41+
// READ version from package.json
42+
const KEPLER_GL_VERSION = '__PACKAGE_VERSION__';
43+
4144
const CustomAddDataButtonFactory = () => {
4245
const NoButton = () => <div />;
4346
return NoButton;
@@ -194,7 +197,7 @@ class KeplerGlComponent extends Component {
194197
mapboxApiAccessToken={this.props.mapboxAPIKey}
195198
id={MAP_ID}
196199
appName="Kepler.gl in Tableau"
197-
version="0.1.0"
200+
version={KEPLER_GL_VERSION}
198201
theme={this.props.theme === 'light' ? 'base' : undefined}
199202
width={this.props.width}
200203
height={this.props.height}

0 commit comments

Comments
 (0)