From a98a015bc95fa0c40e88896a744536061e5039bf Mon Sep 17 00:00:00 2001 From: Shan He Date: Tue, 23 Aug 2022 01:05:07 -0700 Subject: [PATCH] [Bug] Fix getSampleData util import (#1947) - import getSampleData from data-container-utils - Add alias to webpack.confg.local Signed-off-by: Shan He --- examples/demo-app/webpack.config.js | 2 +- examples/webpack.config.local.js | 8 ++++++++ package.json | 4 ++-- src/layers/src/base-layer.ts | 3 ++- 4 files changed, 13 insertions(+), 4 deletions(-) diff --git a/examples/demo-app/webpack.config.js b/examples/demo-app/webpack.config.js index 929d32c94c..9613da1c22 100644 --- a/examples/demo-app/webpack.config.js +++ b/examples/demo-app/webpack.config.js @@ -74,7 +74,7 @@ const CONFIG = { ] }; -// This line enables bundling against src in this repo rather than installed deck.gl module +// This line enables bundling against src in this repo rather than installed kepler.gl module module.exports = env => { return env ? require('../webpack.config.local')(CONFIG, __dirname)(env) : CONFIG; }; diff --git a/examples/webpack.config.local.js b/examples/webpack.config.local.js index 4a8a17169e..c995224827 100644 --- a/examples/webpack.config.local.js +++ b/examples/webpack.config.local.js @@ -64,6 +64,14 @@ function makeLocalDevConfig(env, EXAMPLE_DIR = LIB_DIR, externals = {}) { const useLocalDeck = env.deck || env.hubble_src; const useRepoDeck = env.deck_src; + // add kepler.gl submodule aliases + const workspaces = KeplerPackage.workspaces; + workspaces.forEach(workspace => { + // workspace = "./src/types", "./src/constants", etc + const moduleName = workspace.split('/').pop(); + resolveAlias[`@kepler.gl/${moduleName}`] = join(SRC_DIR, `${moduleName}/src`); + }); + // resolve deck.gl from local dir if (useLocalDeck || useRepoDeck) { // Load deck.gl from root node_modules diff --git a/package.json b/package.json index e6b2c48ada..7e1eae7755 100644 --- a/package.json +++ b/package.json @@ -58,7 +58,7 @@ "start:web": "yarn install-and-start -- website start", "start:https": "yarn install-and-start -- examples/demo-app start-local-https", "start:e2e": "yarn install-and-start -- examples/demo-app start-local-e2e", - "build": "rm -fr dist && babel src/{actions,components,middleware,reducers,templates,cloud-providers,connect,localization,schemas,tasks} --out-dir dist --source-maps inline --extensions '.ts,.tsx,.js,.jsx' --ignore '**/*.d.ts'", + "build": "rm -fr dist && babel src/{actions,components,middleware,reducers,cloud-providers,connect,localization,schemas,tasks} --out-dir dist --source-maps inline --extensions '.ts,.tsx,.js,.jsx' --ignore '**/*.d.ts'", "build:umd": "webpack --config ./webpack/umd.js --progress --env.prod", "build:types": "tsc --project tsconfig.production.json", "analyze": "yarn analyze:bundle", @@ -359,4 +359,4 @@ "node": "12.22.12", "yarn": "1.22.19" } -} +} \ No newline at end of file diff --git a/src/layers/src/base-layer.ts b/src/layers/src/base-layer.ts index 924930e7c2..96d32bbcac 100644 --- a/src/layers/src/base-layer.ts +++ b/src/layers/src/base-layer.ts @@ -66,7 +66,8 @@ import { } from '@kepler.gl/types'; import KeplerTable, {Datasets, GpuFilter} from 'reducers/table-utils/kepler-table'; import {DataContainerInterface} from 'reducers/table-utils/data-container-interface'; -import {getLatLngBounds, getSampleData, isPlainObject, notNullorUndefined} from '@kepler.gl/utils'; +import {getSampleData} from 'reducers/table-utils/data-container-utils'; +import {getLatLngBounds, isPlainObject, notNullorUndefined} from '@kepler.gl/utils'; export type LayerColumn = {value: string | null; fieldIdx: number; optional?: boolean};