pusher/chatkit-client-js

failed "yarn lint:build:test"

Closed this issue · 3 comments

src/main.js → dist/web/chatkit.js...
[!] Error: 'sendRawRequest' is not exported by node_modules/_@pusher_platform@0.16.2@@pusher/platform/dist/web/pusher-platform.js
https://github.com/rollup/rollup/wiki/Troubleshooting#name-is-not-exported-by-module
src/token-provider.js (1:9)
1: import { sendRawRequest } from "@pusher/platform"
^
2:
3: import { appendQueryParams, typeCheck, unixSeconds, urlEncode } from "./utils"

error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

I can't reproduce. Which version are you on? Do you have any output from git diff?

I just had the same problem. It seemed that the issue is between rollup and @pusher/platform.

I'm not an expert but looking into the source code of @pusher/platform it's exported as a CJS module and rollup needs an especial plugin to support them.

basically what I did was to include the chatkit-client library inside node_modules in rollup's commonjs pluginincludeconfig object.

like this:

// rollup.config.js

import commonjs from "rollup-plugin-commonjs";
// More config
commonjs({
      include: ["node_modules/@pusher/chatkit-client/dist/web/chatkit.js"]
    })

An it worked!

Closing as stale, please re-open if still an issue, or contact us via support@pusher.com for more direct help