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

[v2] comlink needs to be an external for server bundle #19

Open
jackyef opened this issue Jan 16, 2020 · 1 comment
Open

[v2] comlink needs to be an external for server bundle #19

jackyef opened this issue Jan 16, 2020 · 1 comment

Comments

@jackyef
Copy link
Contributor

jackyef commented Jan 16, 2020

I was playing around with comlink-loader with an isomorphic react app. I used multi and inline options.

For the client bundle, everything works fine, but it failed when bundling the server bundle.

export 'expose' was not found in 'comlink'

After some digging, I found out that it is fixed after I add /^comlink/ to webpack externals. (My webpack externals config is a bit different, I do not use webpack-node-externals)

So, is it expected that comlink only work when externalised? It didn't throw any error on v1 though.

@developit
Copy link
Collaborator

I haven't had a chance to dig into it yet, but my guess is that this happens due to your bundler ending up choosing the browser version of Comlink rather than the Node version. This is a tricky subject, since bundlers are often configured to prefer "browser" over "main".

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

2 participants