Skip to content

Commit

Permalink
chore: fix ssr-shim import resolve on dev (#8193)
Browse files Browse the repository at this point in the history
In dev the shim js files are not in dist and we need to add resolver so vite finds the ts files in src
  • Loading branch information
ilhan007 authored Jan 29, 2024
1 parent ddc5fe3 commit 71dfd09
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 12 deletions.
2 changes: 1 addition & 1 deletion packages/base/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
"devDependencies": {
"@openui5/sap.ui.core": "1.120.3",
"@ui5/webcomponents-tools": "1.22.0-rc.2",
"chromedriver": "119.0.1",
"chromedriver": "120.0.0",
"clean-css": "^5.2.2",
"copy-and-watch": "^0.1.5",
"cross-env": "^7.0.3",
Expand Down
2 changes: 1 addition & 1 deletion packages/base/src/UI5Element.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// eslint-disable-next-line import/no-extraneous-dependencies
// import "@ui5/webcomponents-base/dist/ssr-dom.js";
import "@ui5/webcomponents-base/dist/ssr-dom.js";
import merge from "./thirdparty/merge.js";
import { boot } from "./Boot.js";
import UI5ElementMetadata, {
Expand Down
4 changes: 2 additions & 2 deletions packages/fiori/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"generate": "nps generate",
"generateAPI": "nps generateAPI",
"bundle": "nps build.bundle",
"test": "wc-dev test",
"test": "wc-dev test && yarn test:ssr",
"test:ssr": "node -e \"import('./test/ssr/component-imports.js')\"",
"create-ui5-element": "wc-create-ui5-element",
"prepublishOnly": "tsc"
Expand All @@ -54,6 +54,6 @@
},
"devDependencies": {
"@ui5/webcomponents-tools": "1.22.0-rc.2",
"chromedriver": "119.0.1"
"chromedriver": "120.0.0"
}
}
2 changes: 1 addition & 1 deletion packages/localization/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"@openui5/sap.ui.core": "1.120.3",
"@ui5/webcomponents-tools": "1.22.0-rc.2",
"babel-plugin-amd-to-esm": "^2.0.3",
"chromedriver": "119.0.1",
"chromedriver": "120.0.0",
"mkdirp": "^1.0.4",
"resolve": "^1.20.0"
},
Expand Down
4 changes: 2 additions & 2 deletions packages/main/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"generateAPI": "nps generateAPI",
"build": "wc-dev build",
"bundle": "nps build.bundle",
"test": "wc-dev test",
"test": "wc-dev test && yarn test:ssr",
"test:ssr": "node -e \"import('./test/ssr/component-imports.js')\"",
"test:suite-1": "wc-dev test-suite-1",
"test:suite-2": "wc-dev test-suite-2",
Expand Down Expand Up @@ -57,6 +57,6 @@
},
"devDependencies": {
"@ui5/webcomponents-tools": "1.22.0-rc.2",
"chromedriver": "119.0.1"
"chromedriver": "120.0.0"
}
}
8 changes: 8 additions & 0 deletions vite.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,16 @@ const customResolver = (id, source, options) => {
}
return resolved;
}

}

// The `base/package.json` has exports that resolves the absolute import to "dist/ssr-dom.js".
// However, in development, the file is not present in `dist`. Instead, load `ssr-dom.ts` from `src`.
if (id === "@ui5/webcomponents-base/dist/ssr-dom.js") {
return join("packages/base/src/ssr-dom.ts");
}


// relative imports from fiori src that are to a folder starting with `illustrations` are in dist
if (source.includes("fiori/src/") && id.includes("/illustrations") && !id.includes("AllIllustrations") && id.startsWith(".")) {
let absoluteId = resolve(dirname(source), id);
Expand Down
24 changes: 19 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4820,7 +4820,7 @@ [email protected]:
resolved "https://registry.yarnpkg.com/axe-core/-/axe-core-4.2.3.tgz#2a3afc332f0031b42f602f4a3de03c211ca98f72"
integrity sha512-pXnVMfJKSIWU2Ml4JHP7pZEPIrgBO1Fd3WGx+fPBsS+KRGhE4vxooD8XBGWbQOIVSZsVK7pUDBBkCicNu80yzQ==

axios@^1.0.0, axios@^1.6.0:
axios@^1.0.0:
version "1.6.2"
resolved "https://registry.yarnpkg.com/axios/-/axios-1.6.2.tgz#de67d42c755b571d3e698df1b6504cde9b0ee9f2"
integrity sha512-7i24Ri4pmDRfJTR7LDBhsOTtcm+9kjX5WiY1X3wIisx6G9So3pfMkEiU7emUBe46oceVImccTEM3k6C5dbVW8A==
Expand All @@ -4829,6 +4829,15 @@ axios@^1.0.0, axios@^1.6.0:
form-data "^4.0.0"
proxy-from-env "^1.1.0"

axios@^1.6.0:
version "1.6.7"
resolved "https://registry.yarnpkg.com/axios/-/axios-1.6.7.tgz#7b48c2e27c96f9c68a2f8f31e2ab19f59b06b0a7"
integrity sha512-/hDJGff6/c7u0hDkvkGxR/oy6CbCs8ziCsC7SqmhjfozqiJGc8Z11wrv9z9lYfY4K8l+H9TpjcMDX0xOZmx+RA==
dependencies:
follow-redirects "^1.15.4"
form-data "^4.0.0"
proxy-from-env "^1.1.0"

[email protected]:
version "0.2.0"
resolved "https://registry.yarnpkg.com/babar/-/babar-0.2.0.tgz#79bc0f029721467207f2b6baedf96b3938ad7db0"
Expand Down Expand Up @@ -5445,10 +5454,10 @@ chrome-launcher@^0.15.0:
is-wsl "^2.2.0"
lighthouse-logger "^1.0.0"

chromedriver@119.0.1:
version "119.0.1"
resolved "https://registry.yarnpkg.com/chromedriver/-/chromedriver-119.0.1.tgz#064f3650790ccea055e9bfd95c600f5ea60295e9"
integrity sha512-lpCFFLaXPpvElTaUOWKdP74pFb/sJhWtWqMjn7Ju1YriWn8dT5JBk84BGXMPvZQs70WfCYWecxdMmwfIu1Mupg==
chromedriver@120.0.0:
version "120.0.0"
resolved "https://registry.yarnpkg.com/chromedriver/-/chromedriver-120.0.0.tgz#34d60a6726a104a348d8dbf82106ca45a430684b"
integrity sha512-LGy2LhWRBiqDarFIU8gQ43EEyj+07Tc3JuUhthkESAwZ99lrifSnKZwKU0aVwansU84+k6bt71z7K3dkk65gZg==
dependencies:
"@testim/chrome-version" "^1.1.4"
axios "^1.6.0"
Expand Down Expand Up @@ -7406,6 +7415,11 @@ follow-redirects@^1.15.0:
resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.15.4.tgz#cdc7d308bf6493126b17ea2191ea0ccf3e535adf"
integrity sha512-Cr4D/5wlrb0z9dgERpUL3LrmPKVDsETIJhaCMeDfuFYcqa5bldGV6wBsAN6X/vxlXQtFBMrXdXxdL8CbDTGniw==

follow-redirects@^1.15.4:
version "1.15.5"
resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.15.5.tgz#54d4d6d062c0fa7d9d17feb008461550e3ba8020"
integrity sha512-vSFWUON1B+yAw1VN4xMfxgn5fTUiaOzAJCKBwIIgT/+7CuGy9+r+5gITvP62j3RmaD5Ph65UaERdOSRGUzZtgw==

for-each@^0.3.3:
version "0.3.3"
resolved "https://registry.yarnpkg.com/for-each/-/for-each-0.3.3.tgz#69b447e88a0a5d32c3e7084f3f1710034b21376e"
Expand Down

0 comments on commit 71dfd09

Please sign in to comment.