mirror of
https://github.com/wassname/talk.git
synced 2026-07-03 19:15:26 +08:00
Improve cross browser support
This commit is contained in:
Generated
+10
-10
@@ -1086,16 +1086,6 @@
|
||||
"@babel/helper-plugin-utils": "7.0.0-beta.49"
|
||||
}
|
||||
},
|
||||
"@babel/plugin-transform-sticky-regex": {
|
||||
"version": "7.0.0-beta.49",
|
||||
"resolved": "https://registry.npmjs.org/@babel/plugin-transform-sticky-regex/-/plugin-transform-sticky-regex-7.0.0-beta.49.tgz",
|
||||
"integrity": "sha1-CMxbZM9qWUKoe92bSkgY1MuhLfM=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@babel/helper-plugin-utils": "7.0.0-beta.49",
|
||||
"@babel/helper-regex": "7.0.0-beta.49"
|
||||
}
|
||||
},
|
||||
"@babel/plugin-transform-template-literals": {
|
||||
"version": "7.0.0-beta.49",
|
||||
"resolved": "https://registry.npmjs.org/@babel/plugin-transform-template-literals/-/plugin-transform-template-literals-7.0.0-beta.49.tgz",
|
||||
@@ -1211,6 +1201,16 @@
|
||||
"@babel/helper-plugin-utils": "7.0.0-beta.49",
|
||||
"@babel/helper-simple-access": "7.0.0-beta.49"
|
||||
}
|
||||
},
|
||||
"@babel/plugin-transform-sticky-regex": {
|
||||
"version": "7.0.0-beta.49",
|
||||
"resolved": "https://registry.npmjs.org/@babel/plugin-transform-sticky-regex/-/plugin-transform-sticky-regex-7.0.0-beta.49.tgz",
|
||||
"integrity": "sha1-CMxbZM9qWUKoe92bSkgY1MuhLfM=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@babel/helper-plugin-utils": "7.0.0-beta.49",
|
||||
"@babel/helper-regex": "7.0.0-beta.49"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@@ -288,6 +288,27 @@ export default function createWebpackConfig({
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
test: /\.js$/,
|
||||
include: /node_modules\//,
|
||||
use: [
|
||||
{
|
||||
loader: require.resolve("babel-loader"),
|
||||
options: {
|
||||
presets: [
|
||||
[
|
||||
"@babel/env",
|
||||
{ targets: "last 2 versions, ie 11", modules: false },
|
||||
],
|
||||
],
|
||||
// This is a feature of `babel-loader` for webpack (not Babel itself).
|
||||
// It enables caching results in ./node_modules/.cache/babel-loader/
|
||||
// directory for faster rebuilds.
|
||||
cacheDirectory: true,
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
// "postcss" loader applies autoprefixer to our CSS.
|
||||
// "css" loader resolves paths in CSS and adds assets as dependencies.
|
||||
// "style" loader turns CSS into JS modules that inject <style> tags.
|
||||
@@ -363,6 +384,22 @@ export default function createWebpackConfig({
|
||||
},
|
||||
};
|
||||
|
||||
const devServerEntries = isProduction
|
||||
? []
|
||||
: [
|
||||
// Include an alternative client for WebpackDevServer. A client's job is to
|
||||
// connect to WebpackDevServer by a socket and get notified about changes.
|
||||
// When you save a file, the client will either apply hot updates (in case
|
||||
// of CSS changes), or refresh the page (in case of JS changes). When you
|
||||
// make a syntax error, this client will display a syntax error overlay.
|
||||
// Note: instead of the default WebpackDevServer client, we use a custom one
|
||||
// to bring better experience for Create React App users. You can replace
|
||||
// the line below with these two lines if you prefer the stock client:
|
||||
// require.resolve('webpack-dev-server/client') + '?/',
|
||||
// require.resolve('webpack/hot/dev-server'),
|
||||
require.resolve("react-dev-utils/webpackHotDevClient"),
|
||||
];
|
||||
|
||||
return [
|
||||
/* Webpack config for our different target, e.g. stream, admin... */
|
||||
{
|
||||
@@ -371,39 +408,16 @@ export default function createWebpackConfig({
|
||||
stream: [
|
||||
// We ship polyfills by default
|
||||
paths.appPolyfill,
|
||||
// Include an alternative client for WebpackDevServer. A client's job is to
|
||||
// connect to WebpackDevServer by a socket and get notified about changes.
|
||||
// When you save a file, the client will either apply hot updates (in case
|
||||
// of CSS changes), or refresh the page (in case of JS changes). When you
|
||||
// make a syntax error, this client will display a syntax error overlay.
|
||||
// Note: instead of the default WebpackDevServer client, we use a custom one
|
||||
// to bring better experience for Create React App users. You can replace
|
||||
// the line below with these two lines if you prefer the stock client:
|
||||
// require.resolve('webpack-dev-server/client') + '?/',
|
||||
// require.resolve('webpack/hot/dev-server'),
|
||||
(isProduction && "") ||
|
||||
require.resolve("react-dev-utils/webpackHotDevClient"),
|
||||
...devServerEntries,
|
||||
paths.appStreamIndex,
|
||||
// Remove deactivated entries.
|
||||
].filter(s => s),
|
||||
],
|
||||
auth: [
|
||||
// We ship polyfills by default
|
||||
paths.appPolyfill,
|
||||
// Include an alternative client for WebpackDevServer. A client's job is to
|
||||
// connect to WebpackDevServer by a socket and get notified about changes.
|
||||
// When you save a file, the client will either apply hot updates (in case
|
||||
// of CSS changes), or refresh the page (in case of JS changes). When you
|
||||
// make a syntax error, this client will display a syntax error overlay.
|
||||
// Note: instead of the default WebpackDevServer client, we use a custom one
|
||||
// to bring better experience for Create React App users. You can replace
|
||||
// the line below with these two lines if you prefer the stock client:
|
||||
// require.resolve('webpack-dev-server/client') + '?/',
|
||||
// require.resolve('webpack/hot/dev-server'),
|
||||
(isProduction && "") ||
|
||||
require.resolve("react-dev-utils/webpackHotDevClient"),
|
||||
...devServerEntries,
|
||||
paths.appAuthIndex,
|
||||
// Remove deactivated entries.
|
||||
].filter(s => s),
|
||||
],
|
||||
},
|
||||
plugins: [
|
||||
...baseConfig.plugins!,
|
||||
@@ -440,12 +454,14 @@ export default function createWebpackConfig({
|
||||
{
|
||||
...baseConfig,
|
||||
entry: [
|
||||
// No polyfills for the embed.
|
||||
(isProduction && "") ||
|
||||
require.resolve("react-dev-utils/webpackHotDevClient"),
|
||||
/* Use minimal amount of polyfills */
|
||||
"core-js/fn/object/assign",
|
||||
"core-js/fn/symbol",
|
||||
"core-js/fn/symbol/iterator",
|
||||
...devServerEntries,
|
||||
paths.appEmbedIndex,
|
||||
// Remove deactivated entries.
|
||||
].filter(s => s),
|
||||
],
|
||||
output: {
|
||||
...baseConfig.output,
|
||||
library: "Talk",
|
||||
@@ -455,7 +471,7 @@ export default function createWebpackConfig({
|
||||
},
|
||||
plugins: [
|
||||
...baseConfig.plugins!,
|
||||
// Generates an `stream.html` file with the <script> injected.
|
||||
// Generates an `embed.html` file with the <script> injected.
|
||||
new HtmlWebpackPlugin({
|
||||
filename: "embed.html",
|
||||
template: paths.appEmbedHTML,
|
||||
|
||||
@@ -95,9 +95,9 @@ function generateTarget(target, context) {
|
||||
`
|
||||
)
|
||||
.join("\n")}
|
||||
contents = contents.concat(suffixes.map(function(suffix) { return require(\`${path
|
||||
contents = contents.concat(suffixes.map(function(suffix) { return require("${path
|
||||
.join(getLocalePath(locale), target)
|
||||
.replace(/\\/g, "/")}\${suffix}\`); }));
|
||||
.replace(/\\/g, "/")}" + suffix); }));
|
||||
ret.bundled[${JSON.stringify(locale)}] = contents.join("\\n");
|
||||
}
|
||||
`
|
||||
@@ -132,9 +132,9 @@ function generateTarget(target, context) {
|
||||
/* webpackChunkName: ${JSON.stringify(
|
||||
`${target}-locale-${locale}`
|
||||
)}, webpackMode: "lazy-once" */
|
||||
\`${path
|
||||
"${path
|
||||
.join(getLocalePath(locale), target)
|
||||
.replace(/\\/g, "/")}\${suffix}\`
|
||||
.replace(/\\/g, "/")}" + suffix
|
||||
)
|
||||
}));
|
||||
return Promise.all(promises).then(function(modules) {
|
||||
|
||||
Reference in New Issue
Block a user