Skip to content

Commit cd86ef9

Browse files
authored
Embed uuid package for Webpack 4 (#5445)
* Embed uuid * Add entry * Add error message
1 parent 706dcd7 commit cd86ef9

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,7 @@ Notes: web developers are advised to use [`~` (tilde range)](https://github.com/
182182
- [`[email protected]`](https://npmjs.com/package/typescript/)
183183
- [`[email protected]`](https://npmjs.com/package/webpack-cli/)
184184
- [`[email protected]`](https://npmjs.com/package/webpack/)
185+
- Fixed [#5446](https://github.com/microsoft/BotFramework-WebChat/issues/5446). Embedded `uuid` so `microsoft-cognitiveservices-speech-sdk` do not need to use dynamic loading, as this could fail in Webpack 4 environment, in PR [#5445](https://github.com/microsoft/BotFramework-WebChat/pull/5445), by [@compulim](https://github.com/compulim)
185186

186187
### Fixed
187188

packages/bundle/tsup.config.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,11 @@ const config: typeof baseConfig = {
4646
'web-speech-cognitive-services',
4747
// Belows are the dependency chain related to "regex" where it is named export-only and does not work on Webpack 4/PPUX (CJS cannot import named export).
4848
// Webpack 4: "Can't import the named export 'rewrite' from non EcmaScript module (only default export is available)"
49-
'shiki' // shiki -> @shikijs/core -> @shikijs/engine-javascript -> regex
49+
'shiki', // shiki -> @shikijs/core -> @shikijs/engine-javascript -> regex
50+
// Issues related to Webpack 4 when it tries to statically analyze dependencies.
51+
// The way `microsoft-cognitiveservices-speech-sdk` imported the `uuid` package (in their `Guid.js`) is causing esbuild/tsup to proxy require() into __require() for dynamic loading.
52+
// Webpack 4 cannot statically analyze the code and failed with error "Critical dependency: require function is used in a way in which dependencies cannot be statically extracted".
53+
'uuid'
5054
]
5155
};
5256

0 commit comments

Comments
 (0)