emberjs / ember-cli-babel Goto Github PK
View Code? Open in Web Editor NEWEmber CLI plugin for Babel
License: MIT License
Ember CLI plugin for Babel
License: MIT License
Error while processing route: index Cannot set property 'foo' of undefined TypeError: Cannot set property 'foo' of undefined
at defineProperties (http://localhost:4200/assets/vendor.js:156343:31)
at http://localhost:4200/assets/vendor.js:156348:23
at http://localhost:4200/assets/vendor.js:156502:5
Failure is coming from
defineProperties(Constructor.prototype, protoProps, protoInitializers) // protoInitializers === undefined
// ... inside defineProperties
if (descriptor.initializer !== undefined) {
initializers[key] = descriptor;continue; // ERROR: Cannot set property 'foo' of undefined
}
var _createDecoratedClass = (function () {
function defineProperties(target, descriptors, initializers) {
for (var i = 0; i < descriptors.length; i++) {
var descriptor = descriptors[i];var decorators = descriptor.decorators;var key = descriptor.key;delete descriptor.key;delete descriptor.decorators;descriptor.enumerable = descriptor.enumerable || false;descriptor.configurable = true;if ('value' in descriptor || descriptor.initializer) descriptor.writable = true;if (decorators) {
for (var f = 0; f < decorators.length; f++) {
var decorator = decorators[f];if (typeof decorator === 'function') {
descriptor = decorator(target, key, descriptor) || descriptor;
} else {
throw new TypeError('The decorator for method ' + descriptor.key + ' is of the invalid type ' + typeof decorator);
}
}if (descriptor.initializer !== undefined) {
initializers[key] = descriptor;continue;
}
}Object.defineProperty(target, key, descriptor);
}
}return function (Constructor, protoProps, staticProps, protoInitializers, staticInitializers) {
if (protoProps) defineProperties(Constructor.prototype, protoProps, protoInitializers);if (staticProps) defineProperties(Constructor, staticProps, staticInitializers);return Constructor;
};
})();
Tests for this can be found here: ember-decorators/ember-decorators/pull/61
Seems like a Babel issue which might have been fixed in later versions. Might need to up babel-core but not too sure.
I spun up a new ember-cli
app, installed ember-cli-babel
, and added 'babel': { compileModules: true }
in my Brocfile.js
. When I run ember server
, I get:
TypeError: Object #<Object> has no method 'indexOf'
at getOptions (/var/node/testapp/node_modules/ember-cli-babel/index.js:28:40)
at Class.module.exports.included (/var/node/testapp/node_modules/ember-cli-babel/index.js:6:19)
at EmberApp.<anonymous> (/var/node/testapp/node_modules/ember-cli/lib/broccoli/ember-app.js:277:15)
at Array.filter (native)
at EmberApp._notifyAddonIncluded (/var/node/testapp/node_modules/ember-cli/lib/broccoli/ember-app.js:272:45)
at new EmberApp (/var/node/testapp/node_modules/ember-cli/lib/broccoli/ember-app.js:236:8)
at Object.<anonymous> (/var/node/testapp/Brocfile.js:5:11)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
It looks to me like this line in index.js is the culprit:
options.blacklist.splice(options.indexOf('es6.modules'), 1);
I think it should be:
options.blacklist.splice(options.blacklist.indexOf('es6.modules'), 1);
Something is still missing, though, because changing that leads to more errors:
ReferenceError: Unknown option: compileModules
at File.normalizeOptions
I'm trying to use Symbol
and the babel page says I need to include the polyfill
What is the best approach to include the polyfill in an ember cli project?
I'd like to make use of some of the plugins - does the steps provided there work as prescribed with this addon (for the host app) ?
lets be sure our windows friends continue to have good support.
When running my Ember-CLI project in our Drone.io CI, I get the following warning:
Cannot find module 'ember-cli-version-checker'
This occurs just since like half an hour and seems to be related to the latest Commit (add7944).
Please revert.
Does this library currently support Ember 2.0? I'm new to Ember, and not sure how to tell if it's in the package.json for example? I didn't see any Ember 2.0 specific stuff in the .travis.yml
Thank you in advance!
I'm on the last ember, ember-cli, ember-data STABLE (not beta), with 5.2.2 I got a big error in ember s
today.
Hey @gordonkristan, awesome job on ember-cli-6to5
! Would you like for it to be migrated over to the 6to5 org? Feel free to decline, just wanted to thank you for taking the time to maintain this, thanks!
At the moment, we treat <foo />
as valid JavaScript and transpile it into React.createElement("foo", null);
. This happens with Babel 4.7.16 as well as the 5.0.0-beta3.
We should probably disable all non-standard syntax, as well syntax that is too early in the standardization process to be considered stable for our purposes. Perhaps we can add flags, so that people can opt-in if they want to test-drive experimental syntax.
I noticed that a fresh install of ember-cli no longer correctly re-compiles on file change. I have tracked this down to a change in broccoli-babel-transpiler. It appears that the change from [email protected] to [email protected] is the problem. Reverting to [email protected] fixes my issues.
I'm seeing "TypeError: regeneratorRuntime.awrap is not a function".
This happens when I try to use the 'async' and 'await' methods.
The packages I use are listed here:
https://gist.github.com/timbaas/8487e7df204dffa651a5effe3eda0450
6to5 have a polyfill for the browser for certain features.
My request is for this plugin to import it by default or give one option to import it in vendor.
Currently I had to:
cp node_modules/ember-cli-6to5/node_modules/broccoli-6to5-transpiler/node_modules/6to5-core/browser-polyfill.js vendor
app.import ('vendor/browser-polyfill.js', {type: 'vendor', prepend: true});
This is needed to keep compatibility with IE8 in certain features.
Looks like Babel 5.3.0 has some pretty significant speed improvements. Any chance of bumping the version to 5.3.0? See https://twitter.com/babeljs/status/598303570824421376.
I try to use ES6 generators in a new clean ember-cli project but it doesn't run in the browser because of Uncaught ReferenceError: regeneratorRuntime is not defined
. It seems there is a missing global/dependency in my service?
function* testGenerator(fixtures) {
for(let i = 0, max = fixtures.length; i < max; ++i) {
yield foo(fixtures[i]);
}
}
6to5 generates this source for my example:
var testGenerator = regeneratorRuntime.mark(function testGenerator(fixtures) {
var i, max;
return regeneratorRuntime.wrap(function testGenerator$(context$1$0) {
while (1) switch (context$1$0.prev = context$1$0.next) {
case 0:
i = 0, max = fixtures.length;
case 1:
if (!(i < max)) {
context$1$0.next = 7;
break;
}
context$1$0.next = 4;
return foo(fixtures[i]);
case 4:
++i;
context$1$0.next = 1;
break;
case 7:
case "end":
return context$1$0.stop();
}
}, testGenerator, this);
});
I'm using [email protected]
and [email protected]
After this one gets merged:
Browser polyfill makes our app crash in IE8.
Declaring a computed property as
fullName: Ember.computed('firstName', 'lastName', ()=>{
return this.get('firstName') + ' ' +this.get('lastName');
})
it is transpiled into,
define('hello-world/components/a-name', ['exports', 'ember', 'hello-world/templates/components/a-name'], function (exports, Ember, layout) {
'use strict';
var _this = undefined;
exports['default'] = Ember['default'].Component.extend({
firstName: "sivakumar",
lastName: "kailasam",
fullName: Ember['default'].computed("firstName", "lastName", function () {
return this.get("firstName") + ' ' +this.get("");
})
});
});
_this = undefined
seems to be wrong to me, is this a genuine issue or am I using arrow functions in a wrong way?
//cc @stefanpenner
npm ERR! notarget No compatible version found: babylon@'>=5.7.5 <6.0.0'
npm ERR! notarget Valid install targets:
npm ERR! notarget ["0.0.1","5.6.23","5.7.1","5.7.2"]
npm ERR! notarget
npm ERR! notarget This is most likely not a problem with npm itself.
npm ERR! notarget In most cases you or one of your dependencies are requesting
npm ERR! notarget a package version that doesn't exist.
npm ERR! notarget
npm ERR! notarget It was specified as a dependency of 'babel-core'
npm ERR! notarget
Just ran into this issue when trying to reinstall my node_modules. The new revision added for broccoli-babel-transpiler has a typo in the name. Fails on install with error:
npm ERR! git rev-list -n1 broccoli-peristent-filter: fatal: ambiguous argument 'broccoli-peristent-filter': unknown revision or path not in the working tree.
Should be: babel/broccoli-babel-transpiler#broccoli-persistent-filter
Actual: babel/broccoli-babel-transpiler#broccoli-peristent-filter
Missing an 's' in persistent
confirmed disabling polyfill fixes issue, Open PR on socket io (socketio/socket.io#2136)
ember serve
version: 1.13.8-master-553e02953a
Cannot set property remoteAddress of #<Socket> which has only a getter
TypeError: Cannot set property remoteAddress of #<Socket> which has only a getter
at _clone (/Users/joshuacope/test/node_modules/ember-cli-babel/node_modules/clone/clone.js:99:16)
at _clone (/Users/joshuacope/test/node_modules/ember-cli-babel/node_modules/clone/clone.js:99:18)
at _clone (/Users/joshuacope/test/node_modules/ember-cli-babel/node_modules/clone/clone.js:99:18)
at _clone (/Users/joshuacope/test/node_modules/ember-cli-babel/node_modules/clone/clone.js:99:18)
at _clone (/Users/joshuacope/test/node_modules/ember-cli-babel/node_modules/clone/clone.js:99:18)
at _clone (/Users/joshuacope/test/node_modules/ember-cli-babel/node_modules/clone/clone.js:99:18)
at _clone (/Users/joshuacope/test/node_modules/ember-cli-babel/node_modules/clone/clone.js:99:18)
at clone (/Users/joshuacope/test/node_modules/ember-cli-babel/node_modules/clone/clone.js:105:10)
at getBabelOptions (/Users/joshuacope/test/node_modules/ember-cli-babel/index.js:68:17)
at Object.registry.add.toTree (/Users/joshuacope/test/node_modules/ember-cli-babel/index.js:21:59)
var app = new EmberApp({
babel: {
includePolyfill: true
}
});
I just upgraded ember-cli from 1.13.8 to master and started to get error:
Build failed.
File: ember-cli-app-version/components/app-version.js
[BABEL] ember-cli-app-version/components/app-version.js: Unknown option: direct.includePolyfill
It goes away if I remove includePolyfill: true
from ember-cli-build.js, but I need the polyfill. It looks like the addon removes options.includePolyfill
so not sure at all why this is an issue.
OK this may be some stupidity on my part but I'm trying to try out the polyfilled features with the latest ember-cli but can't get it to work.
I have a sample repo here https://github.com/patocallaghan/test-app which has some es6 polyfill-only code.
Object.assign({}, { test: "test" });
"234234234".include("5");
var m = new Map();
m.set("hello", 42);
m.set(s, 34);
m.get(s) == 34;
function timeout(duration = 0) {
return new Promise((resolve, reject) => {
setTimeout(resolve, duration);
});
}
I then have the includePolyfill
flag set in ember-cli-build.js. Yet when the JS builds the code isn't transpiled
test-app.js
Object.assign({}, { test: "test" });
"234234234".include("5");
var m = new Map();
m.set("hello", 42);
m.set(s, 34);
m.get(s) == 34;
function timeout() {
var duration = arguments.length <= 0 || arguments[0] === undefined ? 0 : arguments[0];
return new Promise(function (resolve, reject) {
setTimeout(resolve, duration);
});
}
Running ember -v
I get:
version: 1.13.13
node: 5.0.0
npm: 2.14.10
os: darwin x64
Am I missing something? Face-palm at the ready..
Not sure if this is the place, or if tmp
is responsible. See raszi/node-tmp#85
Would be happy to give access to my app for anyone looking to debug.
I am trying to prevent the default compact
behavior of babel
I set
new EmberApp({
babel: {
compact: false
},
that option is never seen in the invocation of babel
I'm logging this.parent.options in setupPreprocessorRegistry and it's undefined.
logging this while I look for correct solution
Hi there.
It seems there is an issue with latest release of ember-cli-babel.
When running npm install on a clean ember-cli-project,
I've got this error message.
~/c/e/facade-web git:master โฏโฏโฏ npm install โฑ
npm ERR! git rev-list -n1 broccoli-peristent-filter: fatal: ambiguous argument 'broccoli-peristent-filter': unknown revision or path not in the working tree.
npm ERR! git rev-list -n1 broccoli-peristent-filter: Use '--' to separate paths from revisions, like this:
npm ERR! git rev-list -n1 broccoli-peristent-filter: 'git <command> [<revision>...] -- [<file>...]'
npm ERR! git rev-list -n1 broccoli-peristent-filter:
npm ERR! git rev-list -n1 broccoli-peristent-filter: fatal: ambiguous argument 'broccoli-peristent-filter': unknown revision or path not in the working tree.
npm ERR! git rev-list -n1 broccoli-peristent-filter: Use '--' to separate paths from revisions, like this:
npm ERR! git rev-list -n1 broccoli-peristent-filter: 'git <command> [<revision>...] -- [<file>...]'
npm ERR! git rev-list -n1 broccoli-peristent-filter:
npm ERR! git rev-list -n1 broccoli-peristent-filter: fatal: ambiguous argument 'broccoli-peristent-filter': unknown revision or path not in the working tree.
npm ERR! git rev-list -n1 broccoli-peristent-filter: Use '--' to separate paths from revisions, like this:
npm ERR! git rev-list -n1 broccoli-peristent-filter: 'git <command> [<revision>...] -- [<file>...]'
npm ERR! git rev-list -n1 broccoli-peristent-filter:
npm ERR! Linux 4.1.4-1-ARCH
npm ERR! argv "node" "/usr/bin/npm" "install"
npm ERR! node v0.12.7
npm ERR! npm v2.13.4
npm ERR! code 128
npm ERR! Command failed: git rev-list -n1 broccoli-peristent-filter
npm ERR! fatal: ambiguous argument 'broccoli-peristent-filter': unknown revision or path not in the working tree.
npm ERR! Use '--' to separate paths from revisions, like this:
npm ERR! 'git <command> [<revision>...] -- [<file>...]'
npm ERR!
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR! <https://github.com/npm/npm/issues>
npm ERR! Please include the following file with any support request:
npm ERR! /home/jlevesy/code/experiments/facade-web/npm-debug.log
When I force ember-cli-babel to 5.1.3, everything runs fine.
Anyway, thanks for your work :)
TypeError: Can't call method on null [
{
"file": "http://stocktonca.localhost:3000/assets/vendor.js",
"line": 810,
"function": ""
},
{
"file": "http://stocktonca.localhost:3000/assets/vendor.js",
"line": 1601,
"function": ""
},
{
"file": "http://stocktonca.localhost:3000/assets/vendor.js",
"line": 3439,
"function": "trim"
}
]
I have includePolyfil
set in my ember-cli-build.js
. Specifically this part errors:
// 1 -> String#trimLeft
// 2 -> String#trimRight
// 3 -> String#trim
var trim = exporter.trim = function(string, TYPE){
string = String(defined(string)); // <-------- HERE
if(TYPE & 1)string = string.replace(ltrim, '');
if(TYPE & 2)string = string.replace(rtrim, '');
return string;
};
Really I'm not sure what the cause is, or if this is the right place for it.
I have a .babelrc file in the parent folder of my ember app which causes ember serve
to fail. If I remove this file then the build works as expected. The file has the following contents:
{
"presets": ["es2015-node4"]
}
The error that is generated is as follows:
File: modules/ember-inflector/index.js
The Broccoli Plugin: [Babel] failed with:
ReferenceError: [BABEL] modules/ember-inflector/index.js: Unknown option: /Users/simonwade/dev/Workspace/activistic-backend/.babelrc.presets
at Logger.error (/Users/simonwade/dev/Workspace/activistic-backend/web-donation-form/node_modules/ember-cli-babel/node_modules/broccoli-babel-transpiler/node_modules/babel-core/lib/transformation/file/logger.js:58:11)
at OptionManager.mergeOptions (/Users/simonwade/dev/Workspace/activistic-backend/web-donation-form/node_modules/ember-cli-babel/node_modules/broccoli-babel-transpiler/node_modules/babel-core/lib/transformation/file/options/option-manager.js:126:29)
at OptionManager.addConfig (/Users/simonwade/dev/Workspace/activistic-backend/web-donation-form/node_modules/ember-cli-babel/node_modules/broccoli-babel-transpiler/node_modules/babel-core/lib/transformation/file/options/option-manager.js:107:10)
at OptionManager.findConfigs (/Users/simonwade/dev/Workspace/activistic-backend/web-donation-form/node_modules/ember-cli-babel/node_modules/broccoli-babel-transpiler/node_modules/babel-core/lib/transformation/file/options/option-manager.js:168:35)
at OptionManager.init (/Users/simonwade/dev/Workspace/activistic-backend/web-donation-form/node_modules/ember-cli-babel/node_modules/broccoli-babel-transpiler/node_modules/babel-core/lib/transformation/file/options/option-manager.js:229:12)
at File.initOptions (/Users/simonwade/dev/Workspace/activistic-backend/web-donation-form/node_modules/ember-cli-babel/node_modules/broccoli-babel-transpiler/node_modules/babel-core/lib/transformation/file/index.js:147:75)
at new File (/Users/simonwade/dev/Workspace/activistic-backend/web-donation-form/node_modules/ember-cli-babel/node_modules/broccoli-babel-transpiler/node_modules/babel-core/lib/transformation/file/index.js:137:22)
at Pipeline.transform (/Users/simonwade/dev/Workspace/activistic-backend/web-donation-form/node_modules/ember-cli-babel/node_modules/broccoli-babel-transpiler/node_modules/babel-core/lib/transformation/pipeline.js:164:16)
at Babel.transform (/Users/simonwade/dev/Workspace/activistic-backend/web-donation-form/node_modules/ember-cli-babel/node_modules/broccoli-babel-transpiler/index.js:105:21)
at Babel.processString (/Users/simonwade/dev/Workspace/activistic-backend/web-donation-form/node_modules/ember-cli-babel/node_modules/broccoli-babel-transpiler/index.js:204:25)
The broccoli plugin was instantiated at:
at Babel.Plugin (/Users/simonwade/dev/Workspace/activistic-backend/web-donation-form/node_modules/ember-cli-babel/node_modules/broccoli-babel-transpiler/node_modules/broccoli-persistent-filter/node_modules/broccoli-plugin/index.js:7:31)
at Babel.Filter [as constructor] (/Users/simonwade/dev/Workspace/activistic-backend/web-donation-form/node_modules/ember-cli-babel/node_modules/broccoli-babel-transpiler/node_modules/broccoli-persistent-filter/index.js:60:10)
at new Babel (/Users/simonwade/dev/Workspace/activistic-backend/web-donation-form/node_modules/ember-cli-babel/node_modules/broccoli-babel-transpiler/index.js:35:10)
at Babel (/Users/simonwade/dev/Workspace/activistic-backend/web-donation-form/node_modules/ember-cli-babel/node_modules/broccoli-babel-transpiler/index.js:30:12)
at Object.registry.add.toTree (/Users/simonwade/dev/Workspace/activistic-backend/web-donation-form/node_modules/ember-cli-babel/index.js:23:52)
at /Users/simonwade/dev/Workspace/activistic-backend/web-donation-form/node_modules/ember-cli/node_modules/ember-cli-preprocess-registry/preprocessors.js:184:26
at Array.forEach (native)
at processPlugins (/Users/simonwade/dev/Workspace/activistic-backend/web-donation-form/node_modules/ember-cli/node_modules/ember-cli-preprocess-registry/preprocessors.js:182:11)
at Function.module.exports.preprocessJs (/Users/simonwade/dev/Workspace/activistic-backend/web-donation-form/node_modules/ember-cli/node_modules/ember-cli-preprocess-registry/preprocessors.js:175:10)
at CoreObject.extend.preprocessJs (/Users/simonwade/dev/Workspace/activistic-backend/web-donation-form/node_modules/ember-cli/lib/models/addon.js:818:25)
i believe we wil; be switching ember-cli proper to 6to5 as esnext + 6to5 are joining forces.
I would love to offer my time to help you maintain this project, if you are interested let me know.
As mentioned in ember-cli/ember-cli#5103 we are currently reading custom properties (includePolyfill
and compileModules
) from the babel
options hash, then deleting them from the hash, and finally passing that hash to broccoli-babel-transpiler
. Instead we should put those options in a ember-cli-babel
options hash, and pass the babel
hash directly to the transpiler.
This should be fixed in a backwards compatible way by deprecating the use of those custom properties in the babel
hash and making both work until the next major version bump.
Since ember-cli
is currently setting the compileModules
option and we don't want to flood our users with deprecation message that they can't fix we should only show those warnings if ember-cli > 2.10
. We should also set some sort of customConfigKey: 'ember-cli-babel'
flag so that ember-cli
knows what config key to use.
/cc @rwjblue
placeholder, document steps required once explored.
When debugging scripts transpiled by "ember-cli-babel" 5.0.0, I see no Source Maps in Chrome.
Is there a hidden flag one must enable?
(Sorry for asking here, but I couldn't find anything related to this).
Hello, I'm trying to make an ember cli addon that uses ES6 classes.
When running ember test
or ember serve
(and going to localhost:4200/tests) the build looks like it succeeds but hangs without the tests executing.
There are no error messages or warnings, it simply freezes with the line "Built project successfully. Stored in "$PATH\tmp\class-tests_dist-cKugYfpG.tmp".
This behavior is replicable with the most simple of ES6 classes, so I assume that there is an issue with the transpiler.
Thanks.
Saying Symbol 'undefined'
when used.
Per talking with @sebmck, it turns out it needs the polyfill http://babeljs.io/docs/usage/polyfill/
Does this mean that ember-cli-babel is not including it and it has to?
I have an issue using let.
Here is my code:
if (a === b ) {
let defaultReturnAddress = {};
let returnAddress = _this.get('currentUser.address');
...
}
if (defaultReturnAddress) {...}
Here is the translation using [email protected]
if (a === b ) {
var _defaultReturnAddress = {};
var returnAddress = _this.get('currentUser.address');
...
}
if (defaultReturnAddress) {...}
It seems to be linked to this error on babel babel/babel#166.
This error was closed a while ago. however, it seems to be a Babel issue.
With a new add-on generated from Ember CLI v0.1.12, simply running npm install --save-dev ember-cli-6to5
as the readme states does not run the add-on code through 6to5. Is there an extra step for Ember CLI add-ons?
I have the following code:
for(let action of listenables) {
let key, callBackName, localName;
That gets transpiled into:
for (var _iterator = listenables[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
var action = _step.value;
This works fine in chrome but fails in phahtomjs which does not recognise iterators.
This appears to be new when building with 5.1.8 (8/11/2016). Reverting to 5.1.6 clears up the issue. Reply if more details are needed. Thank you!
addonContext.ui.writeWarnLine is not a function TypeError: addonContext.ui.writeWarnLine is not a function at Object.options.console.warn ([our project]\node_modules\ember-cli-babel\index.js:79:23) at Babel.optionsHash ([our project]\node_modules\ember-cli-babel\node_modules\broccoli-babel-transpiler\index.js:149:26) at Babel.cacheKeyProcessString ([our project]\node_modules\ember-cli-babel\node_modules\broccoli-babel-transpiler\index.js:186:15) at Object.module.exports.processString ([our project]\node_modules\ember-cli-babel\node_modules\broccoli-babel-transpiler\node_modules\broccoli-persistent-filter\lib\strategies\persistent.js:26:19) at Processor.processString ([our project]\node_modules\ember-cli-babel\node_modules\broccoli-babel-transpiler\node_modules\broccoli-persistent-filter\lib\processor.js:20:25) at [our project]\node_modules\ember-cli-babel\node_modules\broccoli-babel-transpiler\node_modules\broccoli-persistent-filter\index.js:231:16 at lib$rsvp$$internal$$initializePromise ([our project]\node_modules\ember-cli-babel\node_modules\broccoli-babel-transpiler\node_modules\broccoli-persistent-filter\node_modules\rsvp\dist\rsvp.js:1084:9) at new lib$rsvp$promise$$Promise ([our project]\node_modules\ember-cli-babel\node_modules\broccoli-babel-transpiler\node_modules\broccoli-persistent-filter\node_modules\rsvp\dist\rsvp.js:546:53) at invoke ([our project]\node_modules\ember-cli-babel\node_modules\broccoli-babel-transpiler\node_modules\broccoli-persistent-filter\index.js:230:10) at Babel.Filter.processFile ([our project]\node_modules\ember-cli-babel\node_modules\broccoli-babel-transpiler\node_modules\broccoli-persistent-filter\index.js:248:16)
Goals:
Have babel report to us which files/modules depend on which polyfils, Babel may accomplish this by merely appending an import for the polyfil/dep the current module depends on. This would enable subsequent build-tooling to pull in only the polyfils that are needed, and isolate them to the module that explicitly depended on them.
This would help reduce the duplication caused by the small support algorithms currently inlined.
var _temporalAssertDefined = function (val, name, undef) { if (val === undef) { throw new ReferenceError(name + " is not defined - temporal dead zone"); } return true; };
var _temporalUndefined = {};
var _defineProperty = function (obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); };
Example:
given
let b = Symbol('foo')
let a = {
[b]() {
}
}
I would love to see something like:
import _temporalAssertDefined, { _temporalUndefined } from 'babel/temporal-assert-defined';
import _defineProperty from 'babel/defineProperty'
import Symbol from 'babel/core-js/symbol' // or something
var b = _temporalUndefined;
var a = _temporalUndefined;
b = Symbol("foo");
a = _defineProperty({}, _temporalAssertDefined(b, "b", _temporalUndefined) && b, function () {});
Todo:
Questions:
Perhaps we should move ember-cli-version-checker to devDependancies? I tried to upgrade this addon using the steps for upgrading a cli app but get an error:
Cannot find module 'ember-cli-version-checker'
Hello, I'm trying to use this with ES6 compliant classes inside an addon
A class definition of
export class TestFactory {
constructor() {
}
}
Compiles as:
define('ember-ledger-wallet/utils/test-factory', ['exports'], function (exports) {
'use strict';
class TestFactory {
constructor() {
}
}
exports.TestFactory = TestFactory;
});
When running ember serve and the file is in the /addon folder. This causes a syntax error.
Whereas inside the app folder, it is compiling properly as:
define('dummy/utils/test-factory', function () {
'use strict';
var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } };
var TestFactory = exports.TestFactory = function TestFactory() {
_classCallCheck(this, TestFactory);
};
Object.defineProperty(exports, "__esModule", {
value: true
});
});
Any thoughts? Thanks.
I've been doing some IE debugging and noticed a show-stopper that seems to fall into Babel's territory. I keep getting the following issue:
Expected Identifier
Which traces back to the following code:
define('qualaris-mantra/components/ember-wormhole', ['exports', 'ember-wormhole/components/ember-wormhole'], function (exports, ember_wormhole) {
'use strict';
exports.default = ember_wormhole.default; // Error points to this line
});
I went and looked up the ember-wormhole
code that corresponds to this module, and it can be found here. In case you don't feel like following the link, it's just re-exporting another module.
Is this an issue on Babel's end? To me, it seems like the problem is that Babel translates the re-export to
exports.default = ember_wormhole.default;
instead of
exports['default'] = ember_wormhole['default'];
I looked around at all the other modules and they all seem to use the exports['default']
syntax. It's only an issue with IE, and all the other modules seem to be OK.
This was originally opened as an issue as an issue on Babel's repo but we determined that it's probably not an issue with Babel's core. It think it's more likely that the problem is with the transformation the the CLI uses to handle modules instead.
Right now if a compilation error occurs, it only is displayed in the console and the HTTP request hangs.
I have this code in app/pretender/config.js
import Ember from 'ember';
import config from '../config/environment';
var defaultPageSize = config.APP.defaultPageSize;
// Example usage:
// servePaginated('school', { filterField: 'name' })
function servePaginated(type, { filterField }) {
let pluralizedType = Ember.String.pluralize(type);
return function(store, request) {
let results = store.findAll(type);
let filter = request.queryParams.filter;
if (filter && filter.length > 1) {
filter = filter.toLowerCase();
results = results.filter(s => s[filterField].toLowerCase().indexOf(filter) > -1);
}
let pagedResults = results.slice(0, defaultPageSize);
return {
meta: {
total: results.length,
page: 1
},
[pluralizedType]: pagedSchools
};
}
}
I'm pretty sure that this code is correct, and in fact this code works in babejs.io live test page
The error message is Error: Line 23: Unexpected token [
, making reference to [pluralizedType]: pagedResults
.
How can I help trace down this?
I am having trouble while using livereload for ember serve
There is a component which is 2,000 lines template and 1,800 lines in JS.
Here is output for file changes
file changed site/components/site/carpets/neworderform-form/template.hbs - 1822 lines in this template
Build successful - 62844ms.
Slowest Trees | Total
----------------------------------------------+---------------------
Babel | 61122ms
Slowest Trees (cumulative) | Total (avg)
----------------------------------------------+---------------------
Babel (20) | 61280ms (3064 ms)
file changed site/components/site/countries/country-form/template.hbs - 64 lines total in this template
Build successful - 1322ms.
Slowest Trees | Total
----------------------------------------------+---------------------
SourceMapConcat: Concat: App | 424ms
SourceMapConcat: Concat: App Tests | 77ms
Slowest Trees (cumulative) | Total (avg)
----------------------------------------------+---------------------
SourceMapConcat: Concat: App (1) | 424ms
Babel (20) | 199ms (9 ms)
SourceMapConcat: Concat: App Tests (1) | 77ms
I had posted a question on stackoverflow http://stackoverflow.com/questions/38070555/ember-cli-babel-is-too-slow-on-mac but there are no responses
I am using following config
babel: {
compact: true,
comments: false,
includePolyfill: true
}
Iโm trying to integrate ember with Flow Type Checker, but getting an error during ember builds:
File: ember-ajax/ajax-request.js
The Broccoli Plugin: [Babel] failed with:
TypeError: The plugin "transform-flow-strip-types" didn't export a Plugin instance
//ember-cli-build.js
module.exports = function(defaults) {
var app = new EmberAddon(defaults, {
babel: {
plugins: ["transform-flow-strip-types"]
}
});
The error seems to originate from .../node_modules/ember-cli/node_modules/broccoli-babel-transpiler/node_modules/babel-core/lib/transformation/file/plugin-manager.js:165:13)
// validate Transformer instance
if (!plugin.buildPass || plugin.constructor.name !== "Plugin") {
throw new TypeError(messages.get("pluginNotTransformer", name));
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.