Skip to content

Could not load file 'content-scripts/content.js' for content script. It isn't UTF-8 encoded. #151

@mengxi-ream

Description

@mengxi-ream

Bug Description

I tried to use streamdown in my browser extension.

It works on the popup script, but not for all content script.

The error message is Could not load file 'content-scripts/content.js' for content script. It isn't UTF-8 encoded.

Steps to Reproduce

  1. clone the repo for reproduction: https://github.com/mengxi-ream/streamdown-wxt-bug
  2. pnpm i
  3. pnpm dev
    The you will see streamdown works in the popup script
Image

and you now the content script is successfully loaded as we can see hello world is injected to any website.

Image

And then we uncomment the code in content/App.tsx:

import StreamdownExample from "@/components/ui/streamdown-exmaple";

export default function App() {
  return (
    <div className="bg-yellow-400 z-[2147483647] text-2xl">Hello World
      {/* TODO: uncomment this to see the bug: Could not load file 'content-scripts/content.js' for content script. It isn't UTF-8 encoded. */}
      {/* <StreamdownExample /> */}
    </div>);
}

And then pnpm dev again to restart the browser extension, we will see the error:

Could not load file 'content-scripts/content.js' for content script. It isn't UTF-8 encoded.

CleanShot.2025-09-18.at.23.25.05.mp4

Expected Behavior

can load the <StreamdownExample /> in the content script just like it in the popup script

Actual Behavior

got error in background: Could not load file 'content-scripts/content.js' for content script. It isn't UTF-8 encoded.

Code Sample

https://github.com/mengxi-ream/streamdown-wxt-bug

Streamdown Version

1.3.0

React Version

19.1.1

Node.js Version

22.14.0

Browser(s)

Chrome

Operating System

macOS

Additional Context

We are developing an AI browser extension (https://github.com/mengxi-ream/read-frog) and wish to use Streamdown in the future, which I think it's common case for all AI browser extensions (to use Streamdown in the content script)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions