preact-cli icon indicating copy to clipboard operation
preact-cli copied to clipboard

How to use matrix-js-sdk in preact application? Install succeeds, import results in build error …

Open fooness opened this issue 5 years ago • 0 comments

Do you want to request a feature or report a bug? A question, maybe a bug?

What is the current behaviour?

Build failed!

✖ ERROR ../node_modules/matrix-js-sdk/lib/crypto/OutgoingRoomKeyRequestManager.js 195:20
Module parse failed: Unsyntactic break (195:20)
File was processed with these loaders:
 * ../node_modules/babel-loader/lib/index.js
You may need an additional loader to handle the result of these loaders.
|                 })).then(function ($await_8) {
|                   try {
>                     break;
|                   } catch ($boundEx) {
|                     return $error($boundEx);
 @ ../node_modules/matrix-js-sdk/lib/crypto/index.js 51:37-79
 @ ../node_modules/matrix-js-sdk/lib/client.js
 @ ../node_modules/matrix-js-sdk/lib/matrix.js
 @ ../node_modules/matrix-js-sdk/lib/browser-index.js
 @ ../node_modules/babel-loader/lib??ref--4!./routes/explore/index.js
 @ ./routes/explore/index.js
 @ ./components/app.js
 @ ./index.js
 @ ../node_modules/preact-cli/lib/lib/entry.js

If the current behaviour is a bug, please provide the steps to reproduce. npx preact-cli create default my-project cd my-project yarn add matrix-js-sdk vim src/routes/home/index.js -> add import * as sdk from "matrix-js-sdk"; npm run dev

What is the expected behaviour? No build errors should occur.

Please paste the results of `preact info` here.
Environment Info:
  System:
    OS: macOS Mojave 10.14.6
    CPU: (4) x64 Intel(R) Core(TM) i7-4558U CPU @ 2.80GHz
  Binaries:
    Node: 14.12.0 - /usr/local/bin/node
    Yarn: 1.22.4 - /usr/local/bin/yarn
    npm: 6.14.8 - /usr/local/bin/npm
  Browsers:
    Chrome: 81.0.4044.138
    Firefox: 81.0.1
    Safari: 14.0
  npmPackages:
    preact: ^10.3.2 => 10.5.4
    preact-cli: ^3.0.0 => 3.0.3
    preact-render-to-string: ^5.1.4 => 5.1.10
    preact-router: ^3.2.1 => 3.2.1
  npmGlobalPackages:
    preact-cli: 3.0.3

fooness avatar Oct 08 '20 12:10 fooness