From a53b58f8c47ddd584f56c9571c8bd65a28f44b65 Mon Sep 17 00:00:00 2001 From: Tyler Graf Date: Thu, 21 Feb 2019 15:20:16 -0700 Subject: [PATCH 1/3] Edit webpack and webpack dev server configs to work with hf. --- packages/react-scripts/config/webpack.config.js | 14 ++++++++++++-- .../config/webpackDevServer.config.js | 4 ++-- packages/react-scripts/package.json | 3 ++- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/packages/react-scripts/config/webpack.config.js b/packages/react-scripts/config/webpack.config.js index 54f14bc1e2..c5f165e285 100644 --- a/packages/react-scripts/config/webpack.config.js +++ b/packages/react-scripts/config/webpack.config.js @@ -31,6 +31,8 @@ const getClientEnvironment = require('./env'); const ModuleNotFoundPlugin = require('react-dev-utils/ModuleNotFoundPlugin'); const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin-alt'); const typescriptFormatter = require('react-dev-utils/typescriptFormatter'); +const CopyWebpackPlugin = require('copy-webpack-plugin'); + // @remove-on-eject-begin const getCacheIdentifier = require('react-dev-utils/getCacheIdentifier'); // @remove-on-eject-end @@ -237,12 +239,12 @@ module.exports = function(webpackEnv) { // https://twitter.com/wSokra/status/969633336732905474 // https://medium.com/webpack/webpack-4-code-splitting-chunk-graph-and-the-splitchunks-optimization-be739a861366 splitChunks: { - chunks: 'all', + chunks: 'async', name: false, }, // Keep the runtime chunk separated to enable long term caching // https://twitter.com/wSokra/status/969679223278505985 - runtimeChunk: true, + runtimeChunk: false, }, resolve: { // This allows you to set a fallback for where Webpack should look for modules. @@ -512,12 +514,20 @@ module.exports = function(webpackEnv) { ], }, plugins: [ + new CopyWebpackPlugin([ + { + from: path.join(paths.appNodeModules, `hf/dist/${isEnvProduction ? 'prod' : 'dev'}`), + to: 'static/hf/[name].[ext]', + toType: 'template', + }, + ]), // Generates an `index.html` file with the