BotFramework-WebChat icon indicating copy to clipboard operation
BotFramework-WebChat copied to clipboard

Vite: Warnings on console from renderMarkdown sanitize-html dependency

Open RiittaHietaranta opened this issue 2 years ago • 1 comments

Is it an issue related to Adaptive Cards?

No

Is this an accessibility issue?

No

What version of Web Chat are you using?

Latest production

Which distribution are you using Web Chat from?

NPM

Which hosting environment does this issue primarily affect?

Others or unrelated

Which browsers and platforms do the issue happened?

Others or unrelated

Which area does this issue affect?

Others or unrelated

What is the public URL for the website?

No response

Please describe the bug

Our project is a React SPA app and we use Vite (v4.4.4) for building. We use the default markdown which is exported as renderMarkdown botframework-webchat. Running the application results to following warning on console: Module <X> has been externalized for browser compatibility. Cannot access <X.Y> in client code. See http://vitejs.dev/guide/troubleshooting.html#module-externalized-for-browser-compatibility for more details. Affected modules are:

  • path
  • fs
  • url
  • source-map-js All of these are originated from renderMarkdown.ts dependency of sanitize-html.

Do you see any errors in console log?

Only warnings

How to reproduce the issue?

  1. Create new project with Vite
  2. Install botframework-webchat from NPM
  3. Include in project and implement some chat using the default renderMarkdown function
  4. Run using npm run vite Our setup is this, but I would expect the warnings to appear with any usage of the function: import { createDirectLine, Components, renderMarkdown, } from 'botframework-webchat' <Components.Composer directLine={createDirectline({token:token})} renderMarkdown={renderMarkdown} > <Components.BasicWebChat/> </Components.Composer>

What do you expect?

No warnings

What actually happened?

Warnings as stated above

Do you have any screenshots or recordings to repro the issue?

image

Adaptive Card JSON

No response

Additional context

No response

RiittaHietaranta avatar Nov 16 '23 13:11 RiittaHietaranta

AFAIK, there are dependencies outside of Web Chat that imported external and browserify them.

If they are from sanitize-html, could you file the issue to them? We will uptake their latest version when they have resolved the issue.

compulim avatar Mar 30 '24 18:03 compulim