Comments (19)
While we are waiting for #440 to be released, you can use the following hotfix. I'm not proud of that code, but I don't know an easier way to hack into the module system.
/* eslint-disable no-global-assign, func-names, vars-on-top */
if (/Edge\/\d/.test(window.navigator.userAgent)) {
(function(modDecorator, modFieldDescriptor) {
var _define = window.define;
window.define = function define(id, deps, callback) {
_define(id, deps, callback);
if (id === modDecorator) {
window.define = _define;
var mod = window.require(modDecorator);
var _decorator = mod.decorator;
var isDescriptor = window.require(modFieldDescriptor).isDescriptor;
mod.decorator = function decorator(fn) {
return Object.setPrototypeOf(_decorator(fn), Function.prototype);
};
mod.decoratorWithParams = function(fn) {
return function() {
var params = Array.prototype.slice.call(arguments);
if (isDescriptor(params)) {
return mod.decorator(fn).apply(undefined, params);
}
return mod.decorator(function(desc) {
return fn(desc, params);
});
};
};
}
};
})(
'@ember-decorators/utils/decorator',
'@ember-decorators/utils/-private/class-field-descriptor'
);
}
// ember-cli-build.js
const EmberApp = require('ember-cli/lib/broccoli/ember-app');
module.exports = function(defaults) {
const app = new EmberApp(defaults, {});
app.import('vendor/decorators-hotfix.js');
return app.toTree();
};
from ember-decorators.
Thank you for the hotfix @buschtoens, you saved my day!
from ember-decorators.
Since this is fixed in 2.0 and would likely require some significant digging into legacy ember-cli-typescript and ember-decorators versions, I'll mark this as "won't fix".
If we can identify that a lot of folks are affected by this, we can absolutely reopen this bug and evaluate a 1.x patch
from ember-decorators.
Now that ember-cli-typescript@2
has been released, and decorators are transformed the same way regardless of whether original source is JS or TS, this should be re-evaluated.
@mfeckie can you upgrade e-cli-ts
and let us know whether this Edge issue still exists?
from ember-decorators.
This is not an issue when using e-cli-ts@2, only on 1.5
We've migrated our codebase to use 2.x now, so the problem is gone for us, but it was a non trivial feat to upgrade because we also had to convert everything to use decorators (computeds and tasks).
from ember-decorators.
Getting this issue again, but this time it's with [email protected]
from ember-decorators.
Can you add which versions of ember-decorators
and the babel transforms you're using? I'd recommend getting off the stage 2 transforms, and updating to v6, using the polyfill. The stage 1 transforms packaged with ember-cli-babel
could help.
from ember-decorators.
Will give it a trry
from ember-decorators.
If I remove the transforms, I can't get the server to start because it seems to break ember-concurrency-decorators
.
I'm on ember-decorators
v6
ember-cli-babel
7.7.3
from ember-decorators.
So I'm experiencing this issue, and like @mfeckie, I don't really see way out of this, because I can't quite figure out the matrix of:
ember-decorators
ember-cli-typescript
ember-cli-babel-polyfills
that work to solve this problem.
Using
-ember-decorators
6.0.0
ember-cli-babel
7.7.3
ember-concurrency-decorators
0.6.0
- No
@ember-decorators/babel-transforms
Gets the server to start, but errors whenever the app comes across the first decorators.
from ember-decorators.
No @ember-decorators/babel-transforms
I'm currently on mobile, but please use the latest e-c-d beta. It's compatible with stage 1 decorators.
from ember-decorators.
lol, I'm now also running into this bug, with the latest and greatest of all dependencies and without @ember-decorators/babel-transforms
.
I'm experiencing the same issue using these dependencies:
"@ember-decorators/babel-transforms": "^5.1.4",
"@ember-intl/decorators": "^0.4.0",
"ember-cli-babel": "^7.7.3",
"ember-cli-typescript": "^2.0.1",
"ember-concurrency": "^0.9.0",
"ember-concurrency-decorators": "^0.6.0",
I'll investigate and keep this issue open until I know, where the bug is coming from.
from ember-decorators.
I found the cause.
ember-decorators/packages/utils/addon/decorator.js
Lines 69 to 78 in f3e3d63
L73 gets transpiled to:
return decorator(fn).apply(void 0, params);
decorator(fn)
appears to return something weird that is logged as [object Function]
. Inspecting that thing shows that its prototype is set to Object
. You can achieve this manually via Object.setPrototype(function() {}, Object.prototype)
.
I don't know yet, why this only happens for Edge and not for any other browser, including IE11 ironically. I would assume that it's a bug somewhere between ember-concurrency-decorators and ember-decorators. I'll dig further.
from ember-decorators.
Okay, it's broken in ember-decorators. I checked out v5.2.0
, enabled the IE 11 browser in targets.js
and tried running the test suite. It fails with the same error.
Since I personally can't switch to stage 1 / legacy decorators just yet in all applications I maintain (and others as well), I have a vested interest in fixing this. 😄
from ember-decorators.
@buschtoens - I don't understand how the underlying transpilation works (however, I am happy to make uninformed guesses!), but this is the exact same behavior I see.
To add some more confusion, this bug only happens on edge 18 (edge 17 and 16 work as intended).
I'm not sure if this is helpful or not, but I don't think it's e-c-decorators, since we don't have any of those in parts of the app that are initially throwing the error.
from ember-decorators.
@buschtoens Just saw your latest comment. I'd be happy to help/test things out in whatever way I can. I suspect like you, I've coded myself into a corner and this is the only way out.
from ember-decorators.
Not happy that others are having the same issue, but happy that some solutions may be in the pipeline 😄
from ember-decorators.
I'll keep reporting in #e-decorators
to not wreck everybody's inboxes :D
from ember-decorators.
Nice work. I can wait for the PR to be merged thankfully :)
from ember-decorators.
Related Issues (20)
- @service router is undefined HOT 8
- Mixin pattern for polymorphic relationships doesn't seem to work with native classes HOT 1
- @service decorator fails on older browsers like IE11, Chrome 41 (Googlebot) HOT 8
- Polyfills for Symbol, Array.find are required to run on older browsers like IE11
- `@sort` deprecation message missing replacement code HOT 3
- TypeError: Ember._setComputedDecorator is not a function HOT 7
- ember-data decorators HOT 2
- ember-typescript-cli v2 HOT 6
- Question: why is @ember-decorators/babel-transforms still referenced in v6? HOT 2
- attribute component decorator receiving array instead of string HOT 2
- `@service` decorator doesn't work with ember 3.10.0 HOT 9
- `@layout` decorator doesn't work in ember addon HOT 5
- 5.1.4 / 5.2.0 not compatible with iOS 9.3.5 HOT 3
- Recommend usage of `ember-cli-dependency-lint`
- Detect when incompatible versions of `ember-decorators` are clobbering one another
- Add @classNameBindings and @attributeBindings class decorators HOT 2
- 6.1.0: @classNameBindings and @attributeBindings
- Build error: Generic type 'AttrOptions<T>' requires 1 type argument(s).
- Dependency Dashboard
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ember-decorators.