-
-
Notifications
You must be signed in to change notification settings - Fork 399
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[plugin-observable] Observables not working as expected #735
Comments
Can symbol observable package be a problem? So either there was a change and versions are incompatible (I doubt that) or you evtl compiled 2 different versions and they have different refs. In any case we need to address that, I hope you can come up with a change or a PR for this. |
this sounds like you got a problem with a mix of esm and cjs. |
Thanks. The build-process is as vanilla a Webpack 4 config as one could imagine, so it should do CommonJs as expected, but evidently ... something's awry. Incidentally, it would be quite a bit easier to diagnose if there were a base jsFiddle or CodePen. |
FWIW, this looks like a build issue; but a weird one. For interest, the webpack output is unwrapExports(lib);
var symbolObservable = lib; But it should be: var symbolObservable = unwrapExports(lib); Will report as I work through it. |
Relatedly, when my code has this:
i.e. the import is only an issue when it's via the jss library. |
The problem seems to exhibit in |
so you are using a dist version? |
Both are exhibiting the issue. |
i.e. both of these fail:
|
... going to check a CDN version now. |
I guess it will be a problem with dist version if youb have a separate bundle and jss bundle has the symbol built in, so those 2 bundles end up using different symbols. |
on a lib version, the should be using the same symbol. |
The symbol-observable polyfill will always work on a browser where Incidentally, unless I'm missing something really obvious, jss is failing from CDN: <!DOCTYPE html>
<html>
<head>
<script src='https://cdnjs.cloudflare.com/ajax/libs/jss/9.8.6/jss.js'></script>
</head>
<body>
</body>
</html> Console outputs:
Which is the following line from
So I can't seem to test with the CDN either. Maybe a caching issue or something since I've been fiddling locally. |
oh, migration to rollup broke that, webpack has a built-in plugin for "global" replacement |
Yes, these seem like the types of issues one gets with Rollup. :) We had similar problems with tko/knockout. For interest, our rollup config |
looks like we need to add https://www.npmjs.com/package/rollup-plugin-node-globals |
This won't fix the prob with symbols though |
Unfortunately without a control (jsFiddle/CodePen, jss via CDN), we can't eliminate the jss build as the problem. Having stared at it for a couple hours, I do suspect it's the jss build process — but before encouraging a revision of that process I'd like to eliminate the possibility that it's a problem on my end by checking what a CDN version uses for its So step one would seem to be fixing the global symbols. |
You can try in the meantime an older version, which used webpack |
Thanks @kof; what's a recent version compiled with webpack? |
TC39 observables appear to work as expected with 9.8.1, indicating that the Rollup config is the culprit. Probably not relevant, but here's the Webpack version of Object.defineProperty(exports, "__esModule", {
value: true
});
var _symbolObservable = require('symbol-observable');
var _symbolObservable2 = _interopRequireDefault(_symbolObservable);
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : { 'default': obj }; }
exports['default'] = function (value) {
return value && value[_symbolObservable2['default']] &&
value === value[_symbolObservable2['default']]();
}; In contrast to the Rollup version set out in this issue's description, in this Webpacked version we get what is the expected result from dev tools inspection: >>> _symbolObservable2['default'] === Symbol.observable
true |
If you get the error
|
Has anyone had any luck with this? Just ran into it 3 years later. |
Hi again :)
Observables aren't working as expected. In particular, I've a TC39 implementation of Observables which is not being interpreted correctly.
The problem would seem to be the
isObservable
function, which adds this tojss
:Here's some command line output that's illuminating:
It's possible there's some weird things going on with the build process on my end (perhaps I need some webpack-commonjs bridge), but I didn't see any tests in jss that demonstrate the use of
Symbol.observable
proper, so I can't easily eliminate the possibility that it's a jss issue.The text was updated successfully, but these errors were encountered: