You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The problem is this 2 lines in @cycle/time/lib/es6/src/time-driver.js:
// WRONG
import * as requestAnimationFrame from 'raf';
import * as now from 'performance-now';
Those 2 modules export functions, not namespace objects. import * always creates a plain namespace object, which can't be invoked. The correct import statement is without the wildcard:
// WORKS OK
import requestAnimationFrame from 'raf';
import now from 'performance-now';
This bug was unnoticed so far, because most bundler setups are pulling the cjs version (@cycle/time/lib/cjs/src/time-driver.js) instead of the es6 one, and both types of import statements produces the same var <f> = require('...') statement in cjs, which works, because it pulls in the module.exports object - in these cases the function itself.
The es6 version is broken however, and with bundlers which use the es6 version, the result bundle will break.
The text was updated successfully, but these errors were encountered:
I don't know about the CI builds and tests (I tried, but they were not up-to-date, I see there's some work on it nowadays), but I know that the fix doesn't change the cjs result, so no tests should be impacted.
Code to reproduce the issue:
index.js:
index.html:
package.json:
Open http://localhost:1234/ in the browser.
Expected behavior:
Nothing happens, empty screen, no log message.
Actual behavior:
JS error thrown:
Uncaught TypeError: requestAnimationFrame is not a function
Versions of packages used:
See above in package.json
I provided a fix at #891
The problem is this 2 lines in
@cycle/time/lib/es6/src/time-driver.js
:Those 2 modules export functions, not namespace objects.
import *
always creates a plain namespace object, which can't be invoked. The correct import statement is without the wildcard:This bug was unnoticed so far, because most bundler setups are pulling the cjs version (
@cycle/time/lib/cjs/src/time-driver.js
) instead of the es6 one, and both types of import statements produces the samevar <f> = require('...')
statement in cjs, which works, because it pulls in the module.exports object - in these cases the function itself.The es6 version is broken however, and with bundlers which use the es6 version, the result bundle will break.
The text was updated successfully, but these errors were encountered: