forked from emberjs/ember.js
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[BUGFIX lts] Adds the babel-helpers injection plugin back
Helpers were no longer being externalized in our builds, which adds a significant amount to the final payload. This adds them back into the build. Also fixes an issue where the template compiler was not being included in the vendor folder for Ember. ensure async helpers are inlined in dev Cherry-picked from PR emberjs#18291
- Loading branch information
Chris Garrett
authored and
Timothy Asquith
committed
Nov 27, 2019
1 parent
889085c
commit 22ffa39
Showing
4 changed files
with
44 additions
and
24 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
'use strict'; | ||
|
||
const { addNamed } = require('@babel/helper-module-imports'); | ||
|
||
function injectBabelHelpers(isEmberSource = false) { | ||
function injectBabelHelpersPlugin() { | ||
return { | ||
pre(file) { | ||
file.set('helperGenerator', function(name) { | ||
if (name === 'extends') { | ||
return addNamed(file.path, 'assign', '@ember/polyfills'); | ||
} else if (isEmberSource && name === 'asyncToGenerator') { | ||
// Returning a falsy value will cause the helper to be inlined, | ||
// which is fine for local tests | ||
return false; | ||
} | ||
|
||
return addNamed(file.path, name, 'ember-babel'); | ||
}); | ||
}, | ||
}; | ||
} | ||
|
||
injectBabelHelpersPlugin.baseDir = function() { | ||
return 'babel-core'; | ||
}; | ||
|
||
return injectBabelHelpersPlugin; | ||
} | ||
|
||
module.exports = injectBabelHelpers; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters