diff --git a/packages/apps/esm-devtools-app/package.json b/packages/apps/esm-devtools-app/package.json index 1d0f9c22a..8630cc1af 100644 --- a/packages/apps/esm-devtools-app/package.json +++ b/packages/apps/esm-devtools-app/package.json @@ -37,6 +37,7 @@ "access": "public" }, "peerDependencies": { + "@carbon/react": "1.x", "@openmrs/esm-framework": "*", "react": "18.x", "react-dom": "18.x", diff --git a/packages/apps/esm-help-menu-app/package.json b/packages/apps/esm-help-menu-app/package.json index 610c29067..80aba3603 100644 --- a/packages/apps/esm-help-menu-app/package.json +++ b/packages/apps/esm-help-menu-app/package.json @@ -37,6 +37,7 @@ "access": "public" }, "peerDependencies": { + "@carbon/react": "1.x", "@openmrs/esm-framework": "*", "react": "18.x", "react-dom": "18.x", diff --git a/packages/apps/esm-implementer-tools-app/package.json b/packages/apps/esm-implementer-tools-app/package.json index 6f7a9b66f..e146aac72 100644 --- a/packages/apps/esm-implementer-tools-app/package.json +++ b/packages/apps/esm-implementer-tools-app/package.json @@ -42,6 +42,7 @@ "lodash-es": "^4.17.21" }, "peerDependencies": { + "@carbon/react": "1.x", "@openmrs/esm-framework": "*", "react": "18.x", "react-dom": "18.x", diff --git a/packages/apps/esm-login-app/package.json b/packages/apps/esm-login-app/package.json index 21d03de18..b11f3c263 100644 --- a/packages/apps/esm-login-app/package.json +++ b/packages/apps/esm-login-app/package.json @@ -42,6 +42,7 @@ "lodash-es": "^4.17.21" }, "peerDependencies": { + "@carbon/react": "1.x", "@openmrs/esm-framework": "*", "react": "18.x", "react-dom": "18.x", diff --git a/packages/apps/esm-offline-tools-app/package.json b/packages/apps/esm-offline-tools-app/package.json index 12799ac42..e4bf273ad 100644 --- a/packages/apps/esm-offline-tools-app/package.json +++ b/packages/apps/esm-offline-tools-app/package.json @@ -44,6 +44,7 @@ "swr": "^2.2.2" }, "peerDependencies": { + "@carbon/react": "1.x", "@openmrs/esm-framework": "*", "react": "18.x", "react-dom": "18.x", diff --git a/packages/apps/esm-primary-navigation-app/package.json b/packages/apps/esm-primary-navigation-app/package.json index ec2c94622..f20309118 100644 --- a/packages/apps/esm-primary-navigation-app/package.json +++ b/packages/apps/esm-primary-navigation-app/package.json @@ -42,6 +42,7 @@ "lodash-es": "^4.17.21" }, "peerDependencies": { + "@carbon/react": "1.x", "@openmrs/esm-framework": "*", "react": "18.x", "react-dom": "18.x", diff --git a/packages/shell/esm-app-shell/dependencies.json b/packages/shell/esm-app-shell/dependencies.json index c929b7d12..37308c341 100644 --- a/packages/shell/esm-app-shell/dependencies.json +++ b/packages/shell/esm-app-shell/dependencies.json @@ -1,4 +1,5 @@ [ + "@carbon/react", "i18next", "dayjs", "react", diff --git a/packages/shell/esm-app-shell/src/index.ts b/packages/shell/esm-app-shell/src/index.ts index f3fe20b0e..f7c9d5d80 100644 --- a/packages/shell/esm-app-shell/src/index.ts +++ b/packages/shell/esm-app-shell/src/index.ts @@ -1,6 +1,5 @@ import '@openmrs/esm-styleguide/dist/openmrs-esm-styleguide.css'; import 'import-map-overrides'; -import '@openmrs/esm-framework'; import type { SpaConfig } from '@openmrs/esm-framework/src/internal'; function _createSpaBase(baseUrl: string) { diff --git a/packages/shell/esm-app-shell/webpack.config.js b/packages/shell/esm-app-shell/webpack.config.js index 7d3355d71..2a5e45c55 100644 --- a/packages/shell/esm-app-shell/webpack.config.js +++ b/packages/shell/esm-app-shell/webpack.config.js @@ -206,6 +206,9 @@ module.exports = (env, argv = {}) => { ], static: ['src/assets'], }, + watchOptions: { + ignored: ['.git', 'test-results'], + }, mode, devtool: isProd ? 'hidden-nosources-source-map' : 'eval-source-map', module: { @@ -260,6 +263,12 @@ module.exports = (env, argv = {}) => { }, ], }, + optimization: { + splitChunks: { + maxAsyncRequests: 3, + maxInitialRequests: 1, + }, + }, resolve: { mainFields: ['module', 'main'], extensions: ['.ts', '.tsx', '.js', '.jsx', '.css', '.scss'], @@ -271,7 +280,11 @@ module.exports = (env, argv = {}) => { url: false, }, alias: { + 'lodash.debounce': 'lodash-es/debounce', 'lodash.findlast': 'lodash-es/findLast', + 'lodash.isequal': 'lodash-es/isEqual', + 'lodash.omit': 'lodash-es/omit', + 'lodash.throttle': 'lodash-es/throttle', }, }, plugins: [ @@ -332,6 +345,8 @@ module.exports = (env, argv = {}) => { } } + const eager = depName === 'dayjs'; + if (depName === 'swr') { // SWR is annoying with Module Federation // See: https://github.com/webpack/webpack/issues/16125 and https://github.com/vercel/swr/issues/2356 @@ -339,7 +354,7 @@ module.exports = (env, argv = {}) => { requiredVersion: version, strictVersion: false, singleton: true, - eager: true, + eager: false, import: 'swr/', shareKey: 'swr/', shareScope: 'default', @@ -350,7 +365,7 @@ module.exports = (env, argv = {}) => { requiredVersion: version ?? false, strictVersion: false, singleton: true, - eager: true, + eager: eager, import: depName, shareKey: depName, shareScope: 'default', diff --git a/packages/tooling/openmrs/package.json b/packages/tooling/openmrs/package.json index 756440a5f..941710fb1 100644 --- a/packages/tooling/openmrs/package.json +++ b/packages/tooling/openmrs/package.json @@ -44,6 +44,7 @@ "glob": "^7.1.3", "html-webpack-plugin": "^5.5.0", "inquirer": "^7.3.3", + "lodash-es": "^4.17.21", "mini-css-extract-plugin": "^2.4.5", "node-watch": "^0.7.4", "npm-registry-fetch": "^14.0.3", @@ -70,6 +71,7 @@ "@types/express": "^4.11.1", "@types/glob": "^7.1.1", "@types/inquirer": "^6.5.0", + "@types/lodash-es": "^4.17.5", "@types/node": "^18.11.11", "@types/pacote": "^11.1.5", "@types/react": "^18.0.9", diff --git a/packages/tooling/webpack-config/package.json b/packages/tooling/webpack-config/package.json index a766fa43a..81306e121 100644 --- a/packages/tooling/webpack-config/package.json +++ b/packages/tooling/webpack-config/package.json @@ -37,6 +37,7 @@ "css-loader": "^5.2.4", "fork-ts-checker-webpack-plugin": "^6.5.0", "lodash": "^4.17.21", + "lodash-es": "^4.17.21", "sass": ">=1.45.0 <1.65.0", "sass-loader": "^12.3.0", "style-loader": "^3.3.1", @@ -49,6 +50,7 @@ "webpack": "5.x" }, "devDependencies": { + "@types/lodash-es": "^4.17.5", "typescript": "^4.6.4" } } diff --git a/packages/tooling/webpack-config/src/index.ts b/packages/tooling/webpack-config/src/index.ts index 68c9d7587..4cbad11bc 100644 --- a/packages/tooling/webpack-config/src/index.ts +++ b/packages/tooling/webpack-config/src/index.ts @@ -204,7 +204,7 @@ export default (env: Record, argv: Record = {}) merge( { test: /\.css$/, - use: [require.resolve('style-loader'), cssLoader], + use: ['style-loader', cssLoader], }, cssRuleConfig, ), @@ -212,10 +212,10 @@ export default (env: Record, argv: Record = {}) { test: /\.s[ac]ss$/i, use: [ - require.resolve('style-loader'), + 'style-loader', cssLoader, { - loader: require.resolve('sass-loader'), + loader: 'sass-loader', options: { sassOptions: { quietDeps: true } }, }, ], @@ -335,7 +335,11 @@ export default (env: Record, argv: Record = {}) extensions: ['.tsx', '.ts', '.jsx', '.js', '.scss', '.json'], alias: { '@openmrs/esm-framework': '@openmrs/esm-framework/src/internal', + 'lodash.debounce': 'lodash-es/debounce', 'lodash.findlast': 'lodash-es/findLast', + 'lodash.isequal': 'lodash-es/isEqual', + 'lodash.omit': 'lodash-es/omit', + 'lodash.throttle': 'lodash-es/throttle', }, }, ...overrides, diff --git a/yarn.lock b/yarn.lock index 1093dff22..edbd76f3f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3072,6 +3072,7 @@ __metadata: react-i18next: "npm:^11.18.6" webpack: "npm:^5.88.0" peerDependencies: + "@carbon/react": 1.x "@openmrs/esm-framework": "*" react: 18.x react-dom: 18.x @@ -3199,6 +3200,7 @@ __metadata: react-i18next: "npm:^11.18.6" webpack: "npm:^5.88.0" peerDependencies: + "@carbon/react": 1.x "@openmrs/esm-framework": "*" react: 18.x react-dom: 18.x @@ -3224,6 +3226,7 @@ __metadata: swr: "npm:^2.2.2" webpack: "npm:^5.88.0" peerDependencies: + "@carbon/react": 1.x "@openmrs/esm-framework": "*" react: 18.x react-dom: 18.x @@ -3250,6 +3253,7 @@ __metadata: swr: "npm:^2.2.2" webpack: "npm:^5.88.0" peerDependencies: + "@carbon/react": 1.x "@openmrs/esm-framework": "*" react: 18.x react-dom: 18.x @@ -3290,6 +3294,7 @@ __metadata: rxjs: "npm:^6.5.3" swr: "npm:^2.2.2" peerDependencies: + "@carbon/react": 1.x "@openmrs/esm-framework": "*" react: 18.x react-dom: 18.x @@ -3337,6 +3342,7 @@ __metadata: rxjs: "npm:^6.5.3" webpack: "npm:^5.88.0" peerDependencies: + "@carbon/react": 1.x "@openmrs/esm-framework": "*" react: 18.x react-dom: 18.x @@ -3494,11 +3500,13 @@ __metadata: resolution: "@openmrs/webpack-config@workspace:packages/tooling/webpack-config" dependencies: "@swc/core": "npm:^1.3.58" + "@types/lodash-es": "npm:^4.17.5" clean-webpack-plugin: "npm:^4.0.0" copy-webpack-plugin: "npm:^11.0.0" css-loader: "npm:^5.2.4" fork-ts-checker-webpack-plugin: "npm:^6.5.0" lodash: "npm:^4.17.21" + lodash-es: "npm:^4.17.21" sass: "npm:>=1.45.0 <1.65.0" sass-loader: "npm:^12.3.0" style-loader: "npm:^3.3.1" @@ -14250,6 +14258,7 @@ __metadata: "@types/express": "npm:^4.11.1" "@types/glob": "npm:^7.1.1" "@types/inquirer": "npm:^6.5.0" + "@types/lodash-es": "npm:^4.17.5" "@types/node": "npm:^18.11.11" "@types/pacote": "npm:^11.1.5" "@types/react": "npm:^18.0.9" @@ -14267,6 +14276,7 @@ __metadata: glob: "npm:^7.1.3" html-webpack-plugin: "npm:^5.5.0" inquirer: "npm:^7.3.3" + lodash-es: "npm:^4.17.21" mini-css-extract-plugin: "npm:^2.4.5" node-watch: "npm:^0.7.4" npm-registry-fetch: "npm:^14.0.3"