Merge pull request #818 from coralproject/babel

Adds support for disabling the babel-polyfill on the parent embed.js
This commit is contained in:
Wyatt Johnson
2017-08-01 22:32:20 +10:00
committed by GitHub
4 changed files with 20 additions and 8 deletions
+1 -1
View File
@@ -11,4 +11,4 @@
"transform-async-to-generator",
"transform-react-jsx"
]
}
}
+5
View File
@@ -267,6 +267,11 @@ Talk.render = function(el, opts) {
console.warn(
'This page does not include a canonical link tag. Talk has inferred this asset_url from the window object. Query params have been stripped, which may cause a single thread to be present across multiple pages.'
);
if (!window.location.origin) {
window.location.origin = `${window.location.protocol}//${window.location.hostname}${window.location.port ? `:${window.location.port}` : ''}`;
}
query.asset_url = window.location.origin + window.location.pathname;
}
}
+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
@@ -33,6 +33,7 @@ const buildEmbeds = [
const config = {
devtool: 'cheap-module-source-map',
target: 'web',
output: {
path: path.join(__dirname, 'dist'),
publicPath: '/client/',
@@ -153,11 +154,15 @@ 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] = [
'babel-polyfill',
path
];
entry: entries.reduce((entry, {name, path, disablePolyfill = false}) => {
if (disablePolyfill) {
entry[name] = path;
} else {
entry[name] = [
'babel-polyfill',
path
];
}
return entry;
}, {})
@@ -171,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'
}
], {
@@ -183,7 +189,7 @@ module.exports = [
// All framework targets/embeds/plugins.
applyConfig([
// // Load in all the targets.
// Load in all the targets.
...buildTargets.map((target) => ({
name: `${target}/bundle`,
path: path.join(__dirname, 'client/', target, '/src/index')