diff --git a/bin/templates/plugin/client/.babelrc b/bin/templates/plugin/client/.babelrc index 60be246eb..1b77acb76 100644 --- a/bin/templates/plugin/client/.babelrc +++ b/bin/templates/plugin/client/.babelrc @@ -9,6 +9,7 @@ "transform-object-assign", "transform-object-rest-spread", "transform-async-to-generator", - "transform-react-jsx" + "transform-react-jsx", + ["transform-runtime", {"polyfill": false}] ] } \ No newline at end of file diff --git a/client/.babelrc b/client/.babelrc index 63b1c53de..87bd31a04 100644 --- a/client/.babelrc +++ b/client/.babelrc @@ -9,6 +9,7 @@ "transform-object-assign", "transform-object-rest-spread", "transform-async-to-generator", - "transform-react-jsx" + "transform-react-jsx", + ["transform-runtime", {"polyfill": false}] ] } diff --git a/client/coral-embed/src/index.js b/client/coral-embed/src/index.js index 64c274660..dd44e72cd 100644 --- a/client/coral-embed/src/index.js +++ b/client/coral-embed/src/index.js @@ -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; } } diff --git a/docs/_docs/04-03-plugins-client.md b/docs/_docs/04-03-plugins-client.md index 052b90873..d3975913e 100644 --- a/docs/_docs/04-03-plugins-client.md +++ b/docs/_docs/04-03-plugins-client.md @@ -325,7 +325,8 @@ While building your plugin you need to specify a `.eslintrc.json` file and a`.ba "transform-object-assign", "transform-object-rest-spread", "transform-async-to-generator", - "transform-react-jsx" + "transform-react-jsx", + ["transform-runtime", {"polyfill": false}] ] } ``` diff --git a/package.json b/package.json index 476e7eda5..5f0c1cf10 100644 --- a/package.json +++ b/package.json @@ -150,10 +150,12 @@ "babel-plugin-transform-object-assign": "^6.8.0", "babel-plugin-transform-object-rest-spread": "^6.23.0", "babel-plugin-transform-react-jsx": "^6.23.0", + "babel-plugin-transform-runtime": "^6.23.0", "babel-polyfill": "^6.23.0", "babel-preset-es2015": "^6.24.0", "babel-preset-react": "^6.23.0", "babel-preset-stage-0": "^6.16.0", + "babel-runtime": "^6.25.0", "chai": "^3.5.0", "chai-as-promised": "^6.0.0", "chai-http": "^3.0.0", diff --git a/plugin-api/.babelrc b/plugin-api/.babelrc index 63b1c53de..87bd31a04 100644 --- a/plugin-api/.babelrc +++ b/plugin-api/.babelrc @@ -9,6 +9,7 @@ "transform-object-assign", "transform-object-rest-spread", "transform-async-to-generator", - "transform-react-jsx" + "transform-react-jsx", + ["transform-runtime", {"polyfill": false}] ] } diff --git a/plugins/talk-plugin-auth/client/.babelrc b/plugins/talk-plugin-auth/client/.babelrc index 60be246eb..1b77acb76 100644 --- a/plugins/talk-plugin-auth/client/.babelrc +++ b/plugins/talk-plugin-auth/client/.babelrc @@ -9,6 +9,7 @@ "transform-object-assign", "transform-object-rest-spread", "transform-async-to-generator", - "transform-react-jsx" + "transform-react-jsx", + ["transform-runtime", {"polyfill": false}] ] } \ No newline at end of file diff --git a/plugins/talk-plugin-comment-content/client/.babelrc b/plugins/talk-plugin-comment-content/client/.babelrc index 60be246eb..1b77acb76 100644 --- a/plugins/talk-plugin-comment-content/client/.babelrc +++ b/plugins/talk-plugin-comment-content/client/.babelrc @@ -9,6 +9,7 @@ "transform-object-assign", "transform-object-rest-spread", "transform-async-to-generator", - "transform-react-jsx" + "transform-react-jsx", + ["transform-runtime", {"polyfill": false}] ] } \ No newline at end of file diff --git a/plugins/talk-plugin-featured-comments/client/.babelrc b/plugins/talk-plugin-featured-comments/client/.babelrc index 60be246eb..1b77acb76 100644 --- a/plugins/talk-plugin-featured-comments/client/.babelrc +++ b/plugins/talk-plugin-featured-comments/client/.babelrc @@ -9,6 +9,7 @@ "transform-object-assign", "transform-object-rest-spread", "transform-async-to-generator", - "transform-react-jsx" + "transform-react-jsx", + ["transform-runtime", {"polyfill": false}] ] } \ No newline at end of file diff --git a/plugins/talk-plugin-featured-comments/client/components/.babelrc b/plugins/talk-plugin-featured-comments/client/components/.babelrc index 60be246eb..1b77acb76 100644 --- a/plugins/talk-plugin-featured-comments/client/components/.babelrc +++ b/plugins/talk-plugin-featured-comments/client/components/.babelrc @@ -9,6 +9,7 @@ "transform-object-assign", "transform-object-rest-spread", "transform-async-to-generator", - "transform-react-jsx" + "transform-react-jsx", + ["transform-runtime", {"polyfill": false}] ] } \ No newline at end of file diff --git a/plugins/talk-plugin-like/client/.babelrc b/plugins/talk-plugin-like/client/.babelrc index 60be246eb..1b77acb76 100644 --- a/plugins/talk-plugin-like/client/.babelrc +++ b/plugins/talk-plugin-like/client/.babelrc @@ -9,6 +9,7 @@ "transform-object-assign", "transform-object-rest-spread", "transform-async-to-generator", - "transform-react-jsx" + "transform-react-jsx", + ["transform-runtime", {"polyfill": false}] ] } \ No newline at end of file diff --git a/plugins/talk-plugin-love/client/.babelrc b/plugins/talk-plugin-love/client/.babelrc index 60be246eb..f70104134 100644 --- a/plugins/talk-plugin-love/client/.babelrc +++ b/plugins/talk-plugin-love/client/.babelrc @@ -9,6 +9,7 @@ "transform-object-assign", "transform-object-rest-spread", "transform-async-to-generator", - "transform-react-jsx" + ["transform-react-jsx": {"polyfill": false}], + ["transform-runtime", {"polyfill": false}] ] } \ No newline at end of file diff --git a/plugins/talk-plugin-offtopic/client/.babelrc b/plugins/talk-plugin-offtopic/client/.babelrc index 60be246eb..1b77acb76 100644 --- a/plugins/talk-plugin-offtopic/client/.babelrc +++ b/plugins/talk-plugin-offtopic/client/.babelrc @@ -9,6 +9,7 @@ "transform-object-assign", "transform-object-rest-spread", "transform-async-to-generator", - "transform-react-jsx" + "transform-react-jsx", + ["transform-runtime", {"polyfill": false}] ] } \ No newline at end of file diff --git a/plugins/talk-plugin-permalink/client/.babelrc b/plugins/talk-plugin-permalink/client/.babelrc index 60be246eb..1b77acb76 100644 --- a/plugins/talk-plugin-permalink/client/.babelrc +++ b/plugins/talk-plugin-permalink/client/.babelrc @@ -9,6 +9,7 @@ "transform-object-assign", "transform-object-rest-spread", "transform-async-to-generator", - "transform-react-jsx" + "transform-react-jsx", + ["transform-runtime", {"polyfill": false}] ] } \ No newline at end of file diff --git a/plugins/talk-plugin-respect/client/.babelrc b/plugins/talk-plugin-respect/client/.babelrc index 60be246eb..1b77acb76 100644 --- a/plugins/talk-plugin-respect/client/.babelrc +++ b/plugins/talk-plugin-respect/client/.babelrc @@ -9,6 +9,7 @@ "transform-object-assign", "transform-object-rest-spread", "transform-async-to-generator", - "transform-react-jsx" + "transform-react-jsx", + ["transform-runtime", {"polyfill": false}] ] } \ No newline at end of file diff --git a/plugins/talk-plugin-viewing-options/client/.babelrc b/plugins/talk-plugin-viewing-options/client/.babelrc index 60be246eb..1b77acb76 100644 --- a/plugins/talk-plugin-viewing-options/client/.babelrc +++ b/plugins/talk-plugin-viewing-options/client/.babelrc @@ -9,6 +9,7 @@ "transform-object-assign", "transform-object-rest-spread", "transform-async-to-generator", - "transform-react-jsx" + "transform-react-jsx", + ["transform-runtime", {"polyfill": false}] ] } \ No newline at end of file diff --git a/webpack.config.js b/webpack.config.js index 1b3c4b763..94d9ccc44 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -33,6 +33,7 @@ const buildEmbeds = [ const config = { devtool: 'cheap-module-source-map', + target: 'web', output: { path: path.join(__dirname, 'dist'), publicPath: '/client/', @@ -154,11 +155,7 @@ 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[name] = path; return entry; }, {}) }, root); @@ -183,7 +180,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') @@ -192,7 +189,10 @@ module.exports = [ // Load in all the embeds. ...buildEmbeds.map((embed) => ({ name: `embed/${embed}/bundle`, - path: path.join(__dirname, 'client/', `coral-embed-${embed}`, '/src/index') + path: [ + 'babel-polyfill', + path.join(__dirname, 'client/', `coral-embed-${embed}`, '/src/index') + ] })), // Load in all the plugin entries. diff --git a/yarn.lock b/yarn.lock index 255dc7415..c4aa9206d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -989,6 +989,12 @@ babel-plugin-transform-regenerator@^6.24.1: dependencies: regenerator-transform "0.9.11" +babel-plugin-transform-runtime@^6.23.0: + version "6.23.0" + resolved "https://registry.yarnpkg.com/babel-plugin-transform-runtime/-/babel-plugin-transform-runtime-6.23.0.tgz#88490d446502ea9b8e7efb0fe09ec4d99479b1ee" + dependencies: + babel-runtime "^6.22.0" + babel-plugin-transform-strict-mode@^6.24.1: version "6.24.1" resolved "https://registry.yarnpkg.com/babel-plugin-transform-strict-mode/-/babel-plugin-transform-strict-mode-6.24.1.tgz#d5faf7aa578a65bbe591cf5edae04a0c67020758" @@ -1110,6 +1116,13 @@ babel-runtime@^6.11.6, babel-runtime@^6.18.0, babel-runtime@^6.2.0, babel-runtim core-js "^2.4.0" regenerator-runtime "^0.10.0" +babel-runtime@^6.25.0: + version "6.25.0" + resolved "https://registry.yarnpkg.com/babel-runtime/-/babel-runtime-6.25.0.tgz#33b98eaa5d482bb01a8d1aa6b437ad2b01aec41c" + dependencies: + core-js "^2.4.0" + regenerator-runtime "^0.10.0" + babel-template@^6.16.0, babel-template@^6.24.1, babel-template@^6.3.0: version "6.24.1" resolved "https://registry.yarnpkg.com/babel-template/-/babel-template-6.24.1.tgz#04ae514f1f93b3a2537f2a0f60a5a45fb8308333"