Skip to content

Commit 9ddbcce

Browse files
authored
remove overkill use of env to simplify new build process (#2670)
2 parents 33cb2eb + 0d77d3d commit 9ddbcce

File tree

3 files changed

+9
-41
lines changed

3 files changed

+9
-41
lines changed

ember-cli-build.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ module.exports = function (defaults) {
170170
function (dist) {
171171
emberDebugs[dist] = map(emberDebug, '**/*.js', function (content) {
172172
return wrapWithLoader(
173-
`(function(adapter, env) {\n${content}\n}('${dist}', '${env}'))`,
173+
`(function(adapter) {\n${content}\n}('${dist}'))`,
174174
);
175175
});
176176
},

ember_debug/adapters/basic.js

Lines changed: 7 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,6 @@ export default class BasicAdapter extends BaseObject {
1212
this._messageCallbacks = [];
1313
}
1414

15-
/**
16-
* Uses the current build's config module to determine
17-
* the environment.
18-
*
19-
* @property environment
20-
* @type {String}
21-
*/
22-
get environment() {
23-
if (!this.__environment) {
24-
this.__environment =
25-
requireModule('ember-debug/config')['default'].environment;
26-
}
27-
return this.__environment;
28-
}
29-
3015
debug() {
3116
return console.debug(...arguments);
3217
}
@@ -94,19 +79,14 @@ export default class BasicAdapter extends BaseObject {
9479
* @param {Error} error
9580
*/
9681
handleError(error) {
97-
if (this.environment === 'production') {
98-
if (error && error instanceof Error) {
99-
error = `Error message: ${error.message}\nStack trace: ${error.stack}`;
100-
}
101-
this.warn(
102-
`Ember Inspector has errored.\n` +
103-
`This is likely a bug in the inspector itself.\n` +
104-
`You can report bugs at https://github.com/emberjs/ember-inspector.\n${error}`,
105-
);
106-
} else {
107-
this.warn('EmberDebug has errored:');
108-
throw error;
82+
if (error && error instanceof Error) {
83+
error = `Error message: ${error.message}\nStack trace: ${error.stack}`;
10984
}
85+
this.warn(
86+
`Ember Inspector has errored.\n` +
87+
`This is likely a bug in the inspector itself.\n` +
88+
`You can report bugs at https://github.com/emberjs/ember-inspector.\n${error}`,
89+
);
11090
}
11191

11292
/**

ember_debug/vendor/startup-wrapper.js

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,11 @@ let Ember;
1111
Also responsible for sending the first tree.
1212
**/
1313
/*eslint prefer-spread: 0 */
14-
/* globals adapter, env */
14+
/* globals adapter */
1515
var currentAdapter = 'basic';
1616
if (typeof adapter !== 'undefined') {
1717
currentAdapter = adapter;
1818
}
19-
var currentEnv = 'production';
20-
if (typeof env !== 'undefined') {
21-
currentEnv = env;
22-
}
2319

2420
// @formatter:off
2521
var EMBER_VERSIONS_SUPPORTED = {{EMBER_VERSIONS_SUPPORTED}};
@@ -45,14 +41,6 @@ var EMBER_VERSIONS_SUPPORTED = {{EMBER_VERSIONS_SUPPORTED}};
4541

4642
// prevent from injecting twice
4743
if (!window.EmberInspector) {
48-
// Make sure we only work for the supported version
49-
define('ember-debug/config', function() {
50-
return {
51-
default: {
52-
environment: currentEnv
53-
}
54-
};
55-
});
5644

5745
let emberDebugMainModule = requireModule('ember-debug/main');
5846
if (!emberDebugMainModule) {

0 commit comments

Comments
 (0)