Skip to content

Commit 3877776

Browse files
authored
Merge pull request #20 from chriskrycho/before-install
Fix general install issues
2 parents 6db76ca + 1ad5d09 commit 3877776

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

index.js

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,16 @@
33
'use strict';
44
var path = require('path');
55
var process = require('process');
6-
var TsPreprocessor = require('./lib/typescript-preprocessor');
6+
7+
let TsPreprocessor;
8+
try {
9+
TsPreprocessor = require('./lib/typescript-preprocessor');
10+
} catch ( ex ) {
11+
// Do nothing; we just won't have the plugin available. This means that if you
12+
// somehow end up in a state where it doesn't load, the preprocessor *will*
13+
// fail, but this is necessary because the preprocessor depends on packages
14+
// which aren't installed until the
15+
}
716

817
module.exports = {
918
name: 'ember-cli-typescript',
@@ -20,6 +29,11 @@ module.exports = {
2029
},
2130

2231
setupPreprocessorRegistry: function(type, registry) {
32+
if (!TsPreprocessor) {
33+
console.log("Note: TypeScript preprocessor not available -- some dependencies not installed. (If this is during installation of the add-on, this is as expected. If it is while building, serving, or testing the application, this is an error.)");
34+
return;
35+
}
36+
2337
try {
2438
var plugin = new TsPreprocessor({includeExtensions: ['.ts','.js']});
2539
registry.add('js', plugin);

0 commit comments

Comments
 (0)