Added configuration for the babel polyfill

This commit is contained in:
Wyatt Johnson
2017-08-01 19:14:26 +10:00
parent 57ff4f10f3
commit de97ad59ec
2 changed files with 14 additions and 7 deletions
+1
View File
@@ -45,6 +45,7 @@ These are only used during the webpack build.
thread. (Default `3`)
- `TALK_DEFAULT_STREAM_TAB` (_optional_) - specify the default stream tab in the
admin. (Default `all`)
- `TALK_DISABLE_EMBED_POLYFILL` (_optional_) - when set to `TRUE`, the build process will not include the [babel-polyfill](https://babeljs.io/docs/usage/polyfill/) in the embed.js target. (Default `FALSE`)
### Database
+13 -7
View File
@@ -154,8 +154,16 @@ if (process.env.NODE_ENV === 'production') {
// Applies the base configuration to the following entries.
const applyConfig = (entries, root = {}) => _.merge({}, config, {
entry: entries.reduce((entry, {name, path}) => {
entry[name] = path;
entry: entries.reduce((entry, {name, path, disablePolyfill = false}) => {
if (disablePolyfill) {
entry[name] = path;
} else {
entry[name] = [
'babel-polyfill',
path
];
}
return entry;
}, {})
}, root);
@@ -168,7 +176,8 @@ module.exports = [
// Load in the root embed.
{
name: 'embed',
path: path.join(__dirname, 'client/coral-embed/src/index')
path: path.join(__dirname, 'client/coral-embed/src/index'),
disablePolyfill: process.env.TALK_DISABLE_EMBED_POLYFILL === 'TRUE'
}
], {
@@ -189,10 +198,7 @@ module.exports = [
// Load in all the embeds.
...buildEmbeds.map((embed) => ({
name: `embed/${embed}/bundle`,
path: [
'babel-polyfill',
path.join(__dirname, 'client/', `coral-embed-${embed}`, '/src/index')
]
path: path.join(__dirname, 'client/', `coral-embed-${embed}`, '/src/index')
})),
// Load in all the plugin entries.