mirror of
https://github.com/wassname/talk.git
synced 2026-07-05 19:24:30 +08:00
Merge pull request #818 from coralproject/babel
Adds support for disabling the babel-polyfill on the parent embed.js
This commit is contained in:
+1
-1
@@ -11,4 +11,4 @@
|
||||
"transform-async-to-generator",
|
||||
"transform-react-jsx"
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
@@ -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')
|
||||
|
||||
Reference in New Issue
Block a user