Skip to content

Bug: Direct browser script inclusion fails #99

@MinCrohn

Description

@MinCrohn

Current Behavior

When the built library is included directly in an HTML page using a <script> tag (e.g., from a CDN or a local build artifact), it throws an error and fails to initialize or function.

Expected Behavior

The library should load and operate correctly without errors when referenced directly via a <script> tag in a static HTML page. This allows for use in simple static sites or for quick integrations.

Steps to Reproduce

  1. Build the library.
  2. Host the built artifact (e.g., on a local server or a CDN).
  3. Create a minimal index.html file.
  4. In index.html, include the library using a <script> tag:
<script src="[PATH_OR_URL_TO_BUILT_LIBRARY_FILE]"></script>
  1. Attempt to use any functionality provided by the library in a subsequent <script> tag or by inline script.
  2. Open index.html in a browser and observe the error in the developer console.

Environment

System:
  OS: macOS 14.0
  CPU: (8) arm64 Apple M2
  Memory: 65.86 MB / 16.00 GB
  Shell: 5.9 - /bin/zsh
Binaries:
  Node: 22.10.0 - ~/.nvm/versions/node/v22.10.0/bin/node
  npm: 10.9.0 - ~/.nvm/versions/node/v22.10.0/bin/npm
  bun: 1.1.45 - /opt/homebrew/bin/bun
Browsers:
  Chrome: 136.0.7103.114
  Safari: 17.0

Additional Context

No response

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