Skip to content
This repository has been archived by the owner on Jun 11, 2023. It is now read-only.

Error while importing awaitable-timers #59

Open
GHNewbiee opened this issue Nov 30, 2021 · 5 comments
Open

Error while importing awaitable-timers #59

GHNewbiee opened this issue Nov 30, 2021 · 5 comments

Comments

@GHNewbiee
Copy link

GHNewbiee commented Nov 30, 2021

After typing npm i awaitable-timers and

import {
  setTimeout,
  setImmediate,
  setInterval
} from 'awaitable-timers';

I get the following errors:

reboost-awaitable-timers-error-1
reboost-awaitable-timers-error-2

where

awaitable-timers/index.js

'use strict';

// Use the built-in implementations if they are present.
try {
  const {
    setTimeout,
    setImmediate,
    setInterval,
  } = require('timers/promises');

  module.exports = {
    setTimeout,
    setImmediate,
    setInterval,
  };

  return;
} catch {
  // Do nothing with the error.
}
...

Any suggestion? Tia

@GHNewbiee
Copy link
Author

And

reboost.js

const {
  start,
  builtInPlugins: {
    esbuildPlugin
  }
} = require('reboost');

start({
  cacheOnMemory: true,
  contentServer: [
    {
      ...
    }
  ],
  entries: [
    ...
  ],
  hotReload: true,
  plugins: [
    esbuildPlugin({})
  ]
});

@sarsamurmu
Copy link
Owner

sarsamurmu commented Nov 30, 2021

Temporary fix for now

  • Go to node_modules/reboost/dist/node/transformer/processor.js
  • Go to line 102, you would find something like this
ast = (0, meriyah_1.parseModule)(code);
  • Add an extra argument to the function and make it look like this
ast = (0, meriyah_1.parseModule)(code, { globalReturn: true });

@GHNewbiee
Copy link
Author

GHNewbiee commented Dec 1, 2021

Now, I get:

TypeError: Cannot read properties of null (reading 'type')
      at findVisiblePathsInPattern (/home/.../SharedFolder/Frameworks/reboost-lit-test/node_modules/estree-toolkit/dist/scope.js:646:23)
      at registerBindingFromPattern (/home/.../SharedFolder/Frameworks/reboost-lit-test/node_modules/estree-toolkit/dist/scope.js:702:5)
      at CatchClause (/home/.../SharedFolder/Frameworks/reboost-lit-test/node_modules/estree-toolkit/dist/scope.js:823:9)
      at Scope.crawl (/home/.../SharedFolder/Frameworks/reboost-lit-test/node_modules/estree-toolkit/dist/scope.js:907:17)
      at Scope.init (/home/.../SharedFolder/Frameworks/reboost-lit-test/node_modules/estree-toolkit/dist/scope.js:885:14)
      at NodePath.init (/home/.../SharedFolder/Frameworks/reboost-lit-test/node_modules/estree-toolkit/dist/nodepath.js:93:24)
      at Scope.crawl (/home/.../SharedFolder/Frameworks/reboost-lit-test/node_modules/estree-toolkit/dist/scope.js:966:39)
      at Scope.init (/home/.../SharedFolder/Frameworks/reboost-lit-test/node_modules/estree-toolkit/dist/scope.js:885:14)
      at NodePath.init (/home/.../SharedFolder/Frameworks/reboost-lit-test/node_modules/estree-toolkit/dist/nodepath.js:93:24)
      at Traverser.visitPath (/home/.../SharedFolder/Frameworks/reboost-lit-test/node_modules/estree-toolkit/dist/traverse.js:25:18)

BUT I am not sure 100% that I do everything correct from my side. Please test the functions when you have some free time. Tia

@GHNewbiee
Copy link
Author

And those errors and warnings:

Loading module from “http://192.168.1.53:7456/transformed?q=%2Fhome%2F...%2FSharedFolder%2FFrameworks%2Freboost-lit-test%2Fnode_modules%2Fawaitable-timers%2Findex.js” was blocked because of a disallowed MIME type (“text/plain”).
localhost:8000
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://192.168.1.53:7456/transformed?q=%2Fhome%2F...%2FSharedFolder%2FFrameworks%2Freboost-lit-test%2Fnode_modules%2Fawaitable-timers%2Findex.js. (Reason: CORS request did not succeed).

Module source URI is not allowed in this document: “http://192.168.1.53:7456/transformed?q=%2Fhome%2F...%2FSharedFolder%2FFrameworks%2Freboost-lit-test%2Fnode_modules%2Fawaitable-timers%2Findex.js”. localhost:8000:8:1
Loading failed for the module with source “http://192.168.1.53:7456/transformed?q=%2Fhome%2F...%2FSharedFolder%2FFrameworks%2Freboost-lit-test%2Fnode_modules%2F%40lit%2Freactive-element%2Freactive-element.js”. localhost:8000:8:1
Loading failed for the module with source “http://192.168.1.53:7456/transformed?q=%2Fhome%2F...%2FSharedFolder%2FFrameworks%2Freboost-lit-test%2Fnode_modules%2Flit-html%2Flit-html.js”. localhost:8000:8:1
Loading failed for the module with source “http://192.168.1.53:7456/transformed?q=%2Fhome%2F...%2FSharedFolder%2FFrameworks%2Freboost-lit-test%2Fnode_modules%2Flit-element%2Flit-element.js”. localhost:8000:8:1
Loading failed for the module with source “http://192.168.1.53:7456/transformed?q=%2Fhome%2F...%2FSharedFolder%2FFrameworks%2Freboost-lit-test%2Fnode_modules%2F%40lit%2Freactive-element%2Fdecorators%2Fcustom-element.js”. localhost:8000:8:1
Loading failed for the module with source “http://192.168.1.53:7456/transformed?q=%2Fhome%2F...%2FSharedFolder%2FFrameworks%2Freboost-lit-test%2Fnode_modules%2F%40lit%2Freactive-element%2Fdecorators%2Fproperty.js”. localhost:8000:8:1
Loading failed for the module with source “http://192.168.1.53:7456/transformed?q=%2Fhome%2F...%2FSharedFolder%2FFrameworks%2Freboost-lit-test%2Fnode_modules%2F%40lit%2Freactive-element%2Fdecorators%2Fquery.js”. localhost:8000:8:1
Loading failed for the module with source “http://192.168.1.53:7456/transformed?q=%2Fhome%2F...%2FSharedFolder%2FFrameworks%2Freboost-lit-test%2Fnode_modules%2F%40lit%2Freactive-element%2Fdecorators%2Fquery-all.js”. localhost:8000:8:1
Loading failed for the module with source “http://192.168.1.53:7456/transformed?q=%2Fhome%2F...%2FSharedFolder%2FFrameworks%2Freboost-lit-test%2Fnode_modules%2F%40lit%2Freactive-element%2Fdecorators%2Fquery-async.js”. localhost:8000:8:1
Loading failed for the module with source “http://192.168.1.53:7456/transformed?q=%2Fhome%2F...%2FSharedFolder%2FFrameworks%2Freboost-lit-test%2Fnode_modules%2F%40lit%2Freactive-element%2Fdecorators%2Fquery-assigned-nodes.js”. localhost:8000:8:1
Loading failed for the module with source “http://192.168.1.53:7456/transformed?q=%2Fhome%2F...%2FSharedFolder%2FFrameworks%2Freboost-lit-test%2Fnode_modules%2F%40lit%2Freactive-element%2Fdecorators%2Fevent-options.js”. localhost:8000:8:1
Loading failed for the module with source “http://192.168.1.53:7456/transformed?q=%2Fhome%2F...%2FSharedFolder%2FFrameworks%2Freboost-lit-test%2Fnode_modules%2F%40lit%2Freactive-element%2Fdecorators%2Fstate.js”. localhost:8000:8:1
Loading failed for the module with source “http://192.168.1.53:7456/transformed?q=%2Fhome%2F...%2FSharedFolder%2FFrameworks%2Freboost-lit-test%2Fnode_modules%2Flit-html%2Fdirectives%2Fclass-map.js”. localhost:8000:8:1
Loading failed for the module with source “http://192.168.1.53:7456/transformed?q=%2Fhome%2F...%2FSharedFolder%2FFrameworks%2Freboost-lit-test%2Fnode_modules%2Flit-html%2Fdirectives%2Fstyle-map.js”. localhost:8000:8:1

@sarsamurmu
Copy link
Owner

I don't think I can do anything about it now. Try to implement the awaitable-timers functions by yourself for now.

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

No branches or pull requests

2 participants