Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unexpected token '<' #1

Open
RockinRonE opened this issue Jul 3, 2020 · 2 comments
Open

Unexpected token '<' #1

RockinRonE opened this issue Jul 3, 2020 · 2 comments

Comments

@RockinRonE
Copy link

I created a simple object similar to the example:

import { expose } from 'comlink'

export const SortWorker = {
  hello: 'world',
  sort() {
    return 'sort worker ran!'
  },
}

expose(SortWorker)

But I see this in the console: Uncaught SyntaxError: Unexpected token '<'

I am using create-react-app with hooks.

@pocesar
Copy link
Owner

pocesar commented Jul 4, 2020

your route seems to be returning HTML instead of JS, check the body of the request

@dlindahl
Copy link

CRA uses Webpack 4 which does not natively support importing Workers. You need to add the worker-loader. Once CRA updates to use Webpack 5, you may be able to remove this loader.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants