Skip to content
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

[BUGFIX beta] Avoid cache related warnings during builds. #5196

Merged
merged 1 commit into from
Oct 1, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions lib/stripped-build-plugins.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
var path = require('path');
var fs = require('fs');
var FilterImports = require('babel-plugin-filter-imports');
var FeatureFlags = require('babel-plugin-feature-flags');
Expand All @@ -16,6 +17,16 @@ function uniqueAdd(obj, key, values) {
}
}

function addBaseDir(Plugin) {
let type = typeof Plugin;

if (type === 'function' && !Plugin.baseDir) {
Plugin.baseDir = () => path.join(__dirname, '..');
} else if (type === 'object' && Plugin !== null && Plugin.default) {
addBaseDir(Plugin.default);
}
}

module.exports = function(environment) {
var featuresJsonPath = __dirname + '/../config/features.json';
var featuresJson = fs.readFileSync(featuresJsonPath, { encoding: 'utf8' });
Expand Down Expand Up @@ -59,5 +70,12 @@ module.exports = function(environment) {
[TransformBlockScoping, { 'throwIfClosureRequired': true }]
);

// ensures that a `baseDir` property is present on the babel plugins
// that we will be using, this prevents ember-cli-babel/broccoli-babel-transpiler
// from opting out of caching (and printing a giant warning)
plugins.forEach(Plugin => {
addBaseDir(Plugin);
});

return { plugins, postTransformPlugins };
};