Skip to content

Uncaught SyntaxError: Unexpected token 'export' and FileUploadWithPreview is not defined when integrating file-upload-with-preview #86

@shynndex

Description

@shynndex

Describe the bug

I encountered 2 errors when integrating file-upload-with-preview into my HTML project:

  1. Uncaught SyntaxError: Unexpected token 'export' in my index.js file.
  2. Uncaught ReferenceError: FileUploadWithPreview is not defined at the initialization script.

Code Sample

<!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8" />
    <link rel="stylesheet" type="text/css" href="https://unpkg.com/file-upload-with-preview/dist/style.css"/>
  </head>
  <body>
    <div class="custom-file-container" data-upload-id="my-unique-id"></div>
    <script src="https://unpkg.com/file-upload-with-preview/dist/index.js"></script>
    <script>
      const upload = new FileUploadWithPreview.FileUploadWithPreview(
        "my-unique-id"
      );
    </script>
  </body>
</html>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions