Skip to content

Commit

Permalink
Update fixtures/flight to webpack 5 (#25115)
Browse files Browse the repository at this point in the history
* Add new flight fixture

* Move flight dir files

* Enable writeToDisk and distDir

* Move flight2 -> flight

* flight2 -> flight

* Remove unused files

* Remove unused files

* Run prettier

* Ignore eslint cache

Co-authored-by: Sebastian Markbage <[email protected]>
  • Loading branch information
timneutkens and sebmarkbage authored Aug 24, 2022
1 parent 5d1ce65 commit 3d443ca
Show file tree
Hide file tree
Showing 13 changed files with 5,774 additions and 7,946 deletions.
1 change: 0 additions & 1 deletion fixtures/flight/.env

This file was deleted.

2 changes: 0 additions & 2 deletions fixtures/flight/config/env.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,6 @@ function getClientEnvironment(publicUrl) {
WDS_SOCKET_PATH: process.env.WDS_SOCKET_PATH,
WDS_SOCKET_PORT: process.env.WDS_SOCKET_PORT,
// Whether or not react-refresh is enabled.
// react-refresh is not 100% stable at this time,
// which is why it's disabled by default.
// It is defined here so it is available in the webpackHotDevClient.
FAST_REFRESH: process.env.FAST_REFRESH !== 'false',
}
Expand Down
29 changes: 29 additions & 0 deletions fixtures/flight/config/jest/babelTransform.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
'use strict';

const babelJest = require('babel-jest').default;

const hasJsxRuntime = (() => {
if (process.env.DISABLE_NEW_JSX_TRANSFORM === 'true') {
return false;
}

try {
require.resolve('react/jsx-runtime');
return true;
} catch (e) {
return false;
}
})();

module.exports = babelJest.createTransformer({
presets: [
[
require.resolve('babel-preset-react-app'),
{
runtime: hasJsxRuntime ? 'automatic' : 'classic',
},
],
],
babelrc: false,
configFile: false,
});
6 changes: 5 additions & 1 deletion fixtures/flight/config/paths.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ const publicUrlOrPath = getPublicUrlOrPath(
process.env.PUBLIC_URL
);

const buildPath = process.env.BUILD_PATH || 'build';

const moduleFileExtensions = [
'web.mjs',
'mjs',
Expand Down Expand Up @@ -52,7 +54,7 @@ const resolveModule = (resolveFn, filePath) => {
module.exports = {
dotenv: resolveApp('.env'),
appPath: resolveApp('.'),
appBuild: resolveApp('build'),
appBuild: resolveApp(buildPath),
appPublic: resolveApp('public'),
appHtml: resolveApp('public/index.html'),
appIndexJs: resolveModule(resolveApp, 'src/index'),
Expand All @@ -64,6 +66,8 @@ module.exports = {
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'),
swSrc: resolveModule(resolveApp, 'src/service-worker'),
publicUrlOrPath,
};
Expand Down
35 changes: 0 additions & 35 deletions fixtures/flight/config/pnpTs.js

This file was deleted.

Loading

0 comments on commit 3d443ca

Please sign in to comment.