Skip to content

Commit

Permalink
Merge branch 'main' into cleanup-enableSyncDefaultUpdates
Browse files Browse the repository at this point in the history
  • Loading branch information
kassens authored Feb 27, 2023
2 parents 700d5f8 + 6ff1733 commit 383d8f4
Show file tree
Hide file tree
Showing 25 changed files with 750 additions and 1,885 deletions.
66 changes: 0 additions & 66 deletions fixtures/flight/config/getHttpsConfig.js

This file was deleted.

2 changes: 1 addition & 1 deletion fixtures/flight/config/modules.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
const fs = require('fs');
const path = require('path');
const paths = require('./paths');
const chalk = require('react-dev-utils/chalk');
const chalk = require('chalk');
const resolve = require('resolve');

/**
Expand Down
1 change: 0 additions & 1 deletion fixtures/flight/config/paths.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ module.exports = {
appJsConfig: resolveApp('jsconfig.json'),
yarnLockFile: resolveApp('yarn.lock'),
testsSetup: resolveModule(resolveApp, 'src/setupTests'),
proxySetup: resolveApp('src/setupProxy.js'),
appNodeModules: resolveApp('node_modules'),
appWebpackCache: resolveApp('node_modules/.cache'),
appTsBuildInfoFile: resolveApp('node_modules/.cache/tsconfig.tsbuildinfo'),
Expand Down
47 changes: 7 additions & 40 deletions fixtures/flight/config/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ const ReactFlightWebpackPlugin = require('react-server-dom-webpack/plugin');
// Fork End

const fs = require('fs');
const {createHash} = require('crypto');
const path = require('path');
const webpack = require('webpack');
const resolve = require('resolve');
Expand All @@ -14,9 +15,7 @@ const InlineChunkHtmlPlugin = require('react-dev-utils/InlineChunkHtmlPlugin');
const TerserPlugin = require('terser-webpack-plugin');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const CssMinimizerPlugin = require('css-minimizer-webpack-plugin');
const {WebpackManifestPlugin} = require('webpack-manifest-plugin');
const InterpolateHtmlPlugin = require('react-dev-utils/InterpolateHtmlPlugin');
const WorkboxWebpackPlugin = require('workbox-webpack-plugin');
const ModuleScopePlugin = require('react-dev-utils/ModuleScopePlugin');
const getCSSModuleLocalIdent = require('react-dev-utils/getCSSModuleLocalIdent');
const ESLintPlugin = require('eslint-webpack-plugin');
Expand All @@ -30,7 +29,12 @@ const ForkTsCheckerWebpackPlugin =
: require('react-dev-utils/ForkTsCheckerWebpackPlugin');
const ReactRefreshWebpackPlugin = require('@pmmmwh/react-refresh-webpack-plugin');

const createEnvironmentHash = require('./webpack/persistentCache/createEnvironmentHash');
function createEnvironmentHash(env) {
const hash = createHash('md5');
hash.update(JSON.stringify(env));

return hash.digest('hex');
}

// Source maps are resource heavy and can cause out of memory issue for large source files.
const shouldUseSourceMap = process.env.GENERATE_SOURCEMAP !== 'false';
Expand Down Expand Up @@ -632,30 +636,6 @@ module.exports = function (webpackEnv) {
filename: 'static/css/[name].[contenthash:8].css',
chunkFilename: 'static/css/[name].[contenthash:8].chunk.css',
}),
// Generate an asset manifest file with the following content:
// - "files" key: Mapping of all asset filenames to their corresponding
// output file so that tools can pick it up without having to parse
// `index.html`
// - "entrypoints" key: Array of files which are included in `index.html`,
// can be used to reconstruct the HTML if necessary
new WebpackManifestPlugin({
fileName: 'asset-manifest.json',
publicPath: paths.publicUrlOrPath,
generate: (seed, files, entrypoints) => {
const manifestFiles = files.reduce((manifest, file) => {
manifest[file.name] = file.path;
return manifest;
}, seed);
const entrypointFiles = entrypoints.main.filter(
fileName => !fileName.endsWith('.map')
);

return {
files: manifestFiles,
entrypoints: entrypointFiles,
};
},
}),
// Moment.js is an extremely popular library that bundles large locale files
// by default due to how webpack interprets its code. This is a practical
// solution that requires the user to opt into importing specific locales.
Expand All @@ -665,19 +645,6 @@ module.exports = function (webpackEnv) {
resourceRegExp: /^\.\/locale$/,
contextRegExp: /moment$/,
}),
// Generate a service worker script that will precache, and keep up to date,
// the HTML & assets that are part of the webpack build.
isEnvProduction &&
fs.existsSync(swSrc) &&
new WorkboxWebpackPlugin.InjectManifest({
swSrc,
dontCacheBustURLsMatching: /\.[0-9a-f]{8}\./,
exclude: [/\.map$/, /asset-manifest\.json$/, /LICENSE/],
// Bump up the default maximum size (2mb) that's precached,
// to make lazy-loading failure scenarios less likely.
// See https://github.com/cra-template/pwa/issues/13#issuecomment-722667270
maximumFileSizeToCacheInBytes: 5 * 1024 * 1024,
}),
// TypeScript type checking
useTypeScript &&
new ForkTsCheckerWebpackPlugin({
Expand Down

This file was deleted.

133 changes: 0 additions & 133 deletions fixtures/flight/config/webpackDevServer.config.js

This file was deleted.

19 changes: 8 additions & 11 deletions fixtures/flight/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
"babel-loader": "^8.2.3",
"babel-plugin-named-asset-import": "^0.3.8",
"babel-preset-react-app": "^10.0.1",
"bfj": "^7.0.2",
"body-parser": "^1.20.1",
"browserslist": "^4.18.1",
"camelcase": "^6.2.1",
"case-sensitive-paths-webpack-plugin": "^2.4.0",
"compression": "^1.7.4",
"concurrently": "^7.3.0",
"css-loader": "^6.5.1",
"css-minimizer-webpack-plugin": "^3.2.0",
Expand Down Expand Up @@ -56,21 +56,18 @@
"style-loader": "^3.3.1",
"tailwindcss": "^3.0.2",
"terser-webpack-plugin": "^5.2.5",
"web-vitals": "^2.1.0",
"webpack": "^5.64.4",
"webpack-dev-server": "^4.6.0",
"webpack-manifest-plugin": "^4.0.2",
"workbox-webpack-plugin": "^6.4.1"
"webpack-dev-middleware": "^5.3.1"
},
"scripts": {
"predev": "cp -r ../../build/oss-experimental/* ./node_modules/",
"prebuild": "cp -r ../../build/oss-experimental/* ./node_modules/",
"dev": "concurrently \"npm run dev:server\" \"npm run dev:client\"",
"dev:client": "NODE_ENV=development BUILD_PATH=dist node scripts/start.js",
"dev:server": "NODE_ENV=development BUILD_PATH=dist nodemon -- --experimental-loader ./loader/index.js --conditions=react-server server",
"start": "node scripts/build.js && concurrently \"npm run start:server\" \"npm run start:client\"",
"start:client": "cd ./build && python3 -m http.server 3000",
"start:server": "NODE_ENV=production node --experimental-loader ./loader/index.js --conditions=react-server server",
"dev": "concurrently \"npm run dev:region\" \"npm run dev:global\"",
"dev:global": "NODE_ENV=development BUILD_PATH=dist node server/global",
"dev:region": "NODE_ENV=development BUILD_PATH=dist nodemon --watch src --watch dist -- --experimental-loader ./loader/index.js --conditions=react-server server/region",
"start": "node scripts/build.js && concurrently \"npm run start:region\" \"npm run start:global\"",
"start:global": "NODE_ENV=production node server/global",
"start:region": "NODE_ENV=production node --experimental-loader ./loader/index.js --conditions=react-server server/region",
"build": "node scripts/build.js",
"test": "node scripts/test.js --env=jsdom"
},
Expand Down
12 changes: 2 additions & 10 deletions fixtures/flight/scripts/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,8 @@ process.on('unhandledRejection', err => {
require('../config/env');

const path = require('path');
const chalk = require('react-dev-utils/chalk');
const chalk = require('chalk');
const fs = require('fs-extra');
const bfj = require('bfj');
const webpack = require('webpack');
const configFactory = require('../config/webpack.config');
const paths = require('../config/paths');
Expand Down Expand Up @@ -197,20 +196,13 @@ function build(previousFileSizes) {
warnings: messages.warnings,
};

if (writeStatsJson) {
return bfj
.write(paths.appBuild + '/bundle-stats.json', stats.toJson())
.then(() => resolve(resolveArgs))
.catch(error => reject(new Error(error)));
}

return resolve(resolveArgs);
});
});
}

function copyPublicFolder() {
fs.copySync(paths.appPublic, paths.appBuild, {
fs.copySync('public', 'build', {
dereference: true,
filter: file => file !== paths.appHtml,
});
Expand Down
Loading

0 comments on commit 383d8f4

Please sign in to comment.