GoogleChromeLabs / GoogleChromeLabs/comlink

comlink support for ES5

Open
#477 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
12.8k
Forks
435
PR merge metrics
No merged PRs in 30d

Description

Not sure if it's a suggestion or an issue.

I am using `comlink-loader` and I have encountered issue with my webkpack config and comlink.
Indeed, my webpack config transpile my source code from ES6 syntax to ES5.

```tsx
// webpack-config.js
...
{
test: /\.worker\.(js|ts)$/i,
use: [
{
loader: 'comlink-loader',
options: {
singleton: true
}
}
]
},
{
test: /\.(j|t)sx?$/,
use: 'happypack/loader?id=js'
},
{
test: /\.(jpe?g|png|gif|svg)$/i,
use: {
loader: 'file-loader',
options: {
name: production ? '[hash].[ext]' : '[name][hash.[ext]',
outputPath: 'assets/images',
esModule: false
}
}
}
...
```

But comlink module has ES6 syntax out of the box and usually you don't have to transpile `node_modules`.
I am running into this issue:
```tsx
Unexpected token: keyword «const» [./node_modules/comlink/dist/esm/comlink.mjs:13,0][application-f5b2baede3200cfef2b1.js:43532,0]
```

Wouldn't it be better to directly expose ES5 syntax from comlink module ?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.