Skip to content

Commit

Permalink
build: Consume built packages in apps instead of bundling from src (#…
Browse files Browse the repository at this point in the history
…1339)

This addresses our sprint retro item of a test to detect packaging
issues.

By changing the apps to not alias to src files in build mode, the DHC
code-studio should see packages the same way the enterprise web-ui build
will. This should help detect most packaging issues since the majority
of the code in DHC packages are consumed by code-studio.

This seems to make the bundle slightly larger. Probably Vite was able to
de-dupe more when bundling all of the packages from src

As a test, cherry-pick
d1838d7
onto this branch and run build. Should get the same error mentioned in
#1334 when you run build, but not when you run dev mode
  • Loading branch information
mattrunyon authored Jun 2, 2023
1 parent d8e8d29 commit 02b8d4f
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 44 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
"clean": "run-s clean:*",
"types": "tsc --build",
"watch:types": "tsc --build --watch --preserveWatchOutput",
"build": "run-s build:necessary types build:all",
"build:all": "lerna run build --ignore=@deephaven/icons --stream",
"build": "run-s build:necessary types build:packages build:apps",
"build:apps": "lerna run --scope=@deephaven/{code-studio,embed-chart,embed-grid} build",
"build:app": "lerna run --scope=@deephaven/code-studio build",
"build:embed-chart": "lerna run --scope=@deephaven/embed-chart build",
"build:embed-grid": "lerna run --scope=@deephaven/embed-grid build",
Expand Down
31 changes: 17 additions & 14 deletions packages/code-studio/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,20 +79,23 @@ export default defineConfig(({ mode }) => {
},
resolve: {
dedupe: ['react', 'react-redux', 'redux'],
alias: [
{
find: /^@deephaven\/(.*)\/scss\/(.*)/,
replacement: `${packagesDir}/$1/scss/$2`,
},
{
find: /^@deephaven\/icons$/,
replacement: `${packagesDir}/icons/dist/index.es.js`,
},
{
find: /^@deephaven\/(.*)/,
replacement: `${packagesDir}/$1/src`,
},
],
alias:
mode === 'development'
? [
{
find: /^@deephaven\/(.*)\/scss\/(.*)/,
replacement: `${packagesDir}/$1/scss/$2`,
},
{
find: /^@deephaven\/icons$/,
replacement: `${packagesDir}/icons/dist/index.es.js`,
},
{
find: /^@deephaven\/(.*)/,
replacement: `${packagesDir}/$1/src`,
},
]
: [],
},
build: {
outDir: path.resolve(__dirname, env.VITE_BUILD_PATH),
Expand Down
31 changes: 17 additions & 14 deletions packages/embed-chart/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,20 +56,23 @@ export default defineConfig(({ mode }) => {
proxy,
},
resolve: {
alias: [
{
find: /^@deephaven\/(.*)\/scss\/(.*)/,
replacement: `${packagesDir}/$1/scss/$2`,
},
{
find: /^@deephaven\/icons$/,
replacement: `${packagesDir}/icons/dist/index.es.js`,
},
{
find: /^@deephaven\/(.*)/,
replacement: `${packagesDir}/$1/src`,
},
],
alias:
mode === 'development'
? [
{
find: /^@deephaven\/(.*)\/scss\/(.*)/,
replacement: `${packagesDir}/$1/scss/$2`,
},
{
find: /^@deephaven\/icons$/,
replacement: `${packagesDir}/icons/dist/index.es.js`,
},
{
find: /^@deephaven\/(.*)/,
replacement: `${packagesDir}/$1/src`,
},
]
: [],
},
build: {
outDir: env.VITE_BUILD_PATH,
Expand Down
31 changes: 17 additions & 14 deletions packages/embed-grid/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,20 +56,23 @@ export default defineConfig(({ mode }) => {
proxy,
},
resolve: {
alias: [
{
find: /^@deephaven\/(.*)\/scss\/(.*)/,
replacement: `${packagesDir}/$1/scss/$2`,
},
{
find: /^@deephaven\/icons$/,
replacement: `${packagesDir}/icons/dist/index.es.js`,
},
{
find: /^@deephaven\/(.*)/,
replacement: `${packagesDir}/$1/src`,
},
],
alias:
mode === 'development'
? [
{
find: /^@deephaven\/(.*)\/scss\/(.*)/,
replacement: `${packagesDir}/$1/scss/$2`,
},
{
find: /^@deephaven\/icons$/,
replacement: `${packagesDir}/icons/dist/index.es.js`,
},
{
find: /^@deephaven\/(.*)/,
replacement: `${packagesDir}/$1/src`,
},
]
: [],
},
build: {
outDir: env.VITE_BUILD_PATH,
Expand Down

0 comments on commit 02b8d4f

Please sign in to comment.