@reactunity/scripts 0.20.1 → 0.23.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,159 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en-us">
3
+
4
+ <head>
5
+ <meta charset="utf-8">
6
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
7
+ <meta name="viewport" content="width=device-width, initial-scale=1">
8
+
9
+ <title>ReactUnity dev server</title>
10
+ <link rel="icon" href="./favicon.ico">
11
+
12
+ <style>
13
+ body {
14
+ max-width: 44rem;
15
+ margin: 0 auto;
16
+ padding: 3rem 1.5rem;
17
+ font: 16px/1.6 system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
18
+ color: #231F20;
19
+ }
20
+
21
+ header {
22
+ display: flex;
23
+ align-items: center;
24
+ gap: 1rem;
25
+ padding-bottom: 1.5rem;
26
+ margin-bottom: 2.5rem;
27
+ border-bottom: 1px solid #e3e3e8;
28
+ }
29
+
30
+ header img {
31
+ height: 64px;
32
+ }
33
+
34
+ header span {
35
+ font-size: 1.75rem;
36
+ font-weight: 600;
37
+ }
38
+
39
+ h2 {
40
+ font-size: 1.25rem;
41
+ margin: 2.5rem 0 .75rem;
42
+ }
43
+
44
+ code {
45
+ font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
46
+ background: #f1f1f4;
47
+ padding: .1em .3em;
48
+ border-radius: 3px;
49
+ }
50
+
51
+ pre {
52
+ background: #f1f1f4;
53
+ padding: .9rem 1rem;
54
+ border-radius: 6px;
55
+ overflow-x: auto;
56
+ }
57
+
58
+ pre code {
59
+ background: none;
60
+ padding: 0;
61
+ }
62
+
63
+ .note {
64
+ border-left: 3px solid #f0ad4e;
65
+ background: #fdf7ec;
66
+ padding: .9rem 1rem;
67
+ border-radius: 0 6px 6px 0;
68
+ }
69
+
70
+ a {
71
+ color: #3f51b5;
72
+ }
73
+
74
+ @media (prefers-color-scheme: dark) {
75
+ body {
76
+ background: #1b1b1f;
77
+ color: #e8e8ea;
78
+ }
79
+
80
+ header {
81
+ border-bottom-color: #34343a;
82
+ }
83
+
84
+ code,
85
+ pre {
86
+ background: #2a2a30;
87
+ }
88
+
89
+ .note {
90
+ background: #2e2820;
91
+ }
92
+
93
+ a {
94
+ color: #9fa8da;
95
+ }
96
+ }
97
+ </style>
98
+ </head>
99
+
100
+ <body>
101
+ <header>
102
+ <img src="./favicon.ico" alt="">
103
+ <span>ReactUnity dev server</span>
104
+ </header>
105
+
106
+ <p>
107
+ This server is running. It serves the JavaScript and asset files your ReactUnity app is built
108
+ from, and reloads them as you edit.
109
+ </p>
110
+
111
+ <h2>Connecting Unity to it</h2>
112
+
113
+ <p>
114
+ Set the <code>DevServer</code> property of your <code>ReactRendererUGUI</code> or
115
+ <code>ReactRendererUIToolkit</code> component to the address of this page, then press play.
116
+ </p>
117
+
118
+ <h2>Previewing in the browser</h2>
119
+
120
+ <p>
121
+ <a href="./">The previewer</a> runs your UI in a Unity WebGL player right in the browser, with
122
+ no editor open. Useful when starting out or for quick iteration on simple UI.
123
+ </p>
124
+
125
+ <div class="note">
126
+ ReactUnity is not optimised for WebGL, so expect noticeably lower performance in the previewer
127
+ than in a real player. It also has limited capabilities and will not handle every case.
128
+ </div>
129
+
130
+ <p>
131
+ The Unity build behind it is hosted on <code>reactunity.github.io</code> rather than shipped as
132
+ a dependency, so nothing is downloaded at install time. The first load fetches it over the
133
+ network and the browser caches it afterwards.
134
+ </p>
135
+
136
+ <h2>Using your own previewer</h2>
137
+
138
+ <p>
139
+ You can replace the previewer with your own scene &mdash; which is also how you preview
140
+ offline. Build a scene in Unity with a <code>ReactRendererUGUI</code> component added, with its
141
+ <code>Type</code> set to <code>Url</code> and <code>Source Path</code> set to
142
+ <code>/index.js</code>. Then copy the build output into a <code>previewer</code> folder in your
143
+ React project, so that this file exists:
144
+ </p>
145
+
146
+ <pre><code>previewer/index.html</code></pre>
147
+
148
+ <p>
149
+ The dev server serves that in preference to the hosted previewer. Your project's own
150
+ <code>public</code> folder takes precedence over both.
151
+ </p>
152
+
153
+ <p>
154
+ See the <a href="https://github.com/ReactUnity/core/tree/main/packages/scripts">@reactunity/scripts
155
+ documentation</a> for the environment variables that control the build.
156
+ </p>
157
+ </body>
158
+
159
+ </html>
@@ -1,5 +1,15 @@
1
1
  function registerUnityMiddleware(app) {
2
- // Allow serving Unity builds
2
+ // Allow serving Unity builds.
3
+ //
4
+ // The patterns are regular expressions rather than the `'*.unityweb'` globs they used to
5
+ // be. Express 5 -- which webpack-dev-server 6 depends on -- routes through path-to-regexp
6
+ // 8, and that rejects a bare `*`: it wants a named wildcard (`/*splat`), and there is no
7
+ // spelling of "any path ending in .unityweb" in that syntax. A RegExp route says it
8
+ // directly and works on Express 4 and 5 alike.
9
+ //
10
+ // Worth knowing if this regresses: the throw surfaces as `react-unity-scripts start`
11
+ // printing "Starting the development server..." and then hanging with nothing listening,
12
+ // because the rejection lands in webpack-dev-server's startCallback.
3
13
  function contentEncodingShorthand(pattern, encoding) {
4
14
  app.get(pattern, (req, res, next) => {
5
15
  res.set('Content-Encoding', encoding);
@@ -14,14 +24,14 @@ function registerUnityMiddleware(app) {
14
24
  });
15
25
  }
16
26
 
17
- contentEncodingShorthand('*.unityweb', 'gzip');
18
- contentEncodingShorthand('*.gz', 'gzip');
19
- contentEncodingShorthand('*.br', 'br');
20
- contentTypeShorthand('*.js.gz', 'application/javascript');
21
- contentTypeShorthand('*.js.br', 'application/javascript');
22
- contentTypeShorthand('*.wasm', 'application/wasm');
23
- contentTypeShorthand('*.wasm.gz', 'application/wasm');
24
- contentTypeShorthand('*.wasm.br', 'application/wasm');
27
+ contentEncodingShorthand(/\.unityweb$/, 'gzip');
28
+ contentEncodingShorthand(/\.gz$/, 'gzip');
29
+ contentEncodingShorthand(/\.br$/, 'br');
30
+ contentTypeShorthand(/\.js\.gz$/, 'application/javascript');
31
+ contentTypeShorthand(/\.js\.br$/, 'application/javascript');
32
+ contentTypeShorthand(/\.wasm$/, 'application/wasm');
33
+ contentTypeShorthand(/\.wasm\.gz$/, 'application/wasm');
34
+ contentTypeShorthand(/\.wasm\.br$/, 'application/wasm');
25
35
  }
26
36
 
27
37
  module.exports = {
@@ -1,4 +1,3 @@
1
-
2
1
  const { createHash } = require('node:crypto');
3
2
 
4
3
  module.exports = (env) => {
@@ -1,7 +1,6 @@
1
1
  const fs = require('node:fs');
2
2
  const path = require('node:path');
3
3
  const webpack = require('webpack');
4
- const resolve = require('resolve');
5
4
  const CaseSensitivePathsPlugin = require('case-sensitive-paths-webpack-plugin');
6
5
  const TerserPlugin = require('terser-webpack-plugin');
7
6
  const MiniCssExtractPlugin = require('mini-css-extract-plugin');
@@ -12,10 +11,6 @@ const paths = require('./paths');
12
11
  const modules = require('./modules');
13
12
  const getClientEnvironment = require('./env');
14
13
  const ModuleNotFoundPlugin = require('react-dev-utils/ModuleNotFoundPlugin');
15
- const ForkTsCheckerWebpackPlugin =
16
- process.env.TSC_COMPILE_ON_ERROR === 'true'
17
- ? require('react-dev-utils/ForkTsCheckerWarningWebpackPlugin')
18
- : require('react-dev-utils/ForkTsCheckerWebpackPlugin');
19
14
  const ReactRefreshWebpackPlugin = require('@pmmmwh/react-refresh-webpack-plugin');
20
15
  // @remove-on-eject-begin
21
16
  const getCacheIdentifier = require('react-dev-utils/getCacheIdentifier');
@@ -30,11 +25,12 @@ const sourceMapType = sourceMapVar !== 'false' && sourceMapVar !== 'true' && sou
30
25
 
31
26
  const reactRefreshRuntimeEntry = require.resolve('react-refresh/runtime');
32
27
  const reactRefreshWebpackPluginRuntimeEntry = require.resolve('@pmmmwh/react-refresh-webpack-plugin');
33
- const babelRuntimeEntry = require.resolve('babel-preset-react-app');
34
- const babelRuntimeEntryHelpers = require.resolve('@babel/runtime/helpers/esm/assertThisInitialized', { paths: [babelRuntimeEntry] });
35
- const babelRuntimeRegenerator = require.resolve('@babel/runtime/regenerator', {
36
- paths: [babelRuntimeEntry],
37
- });
28
+ const babelRuntimeEntry = require.resolve('@babel/runtime/package.json');
29
+ // @babel/runtime 8 reshaped its export map: the helpers are no longer split into
30
+ // helpers/esm/*, and `regenerator` is gone entirely (Babel 8 dropped regenerator, and
31
+ // transform-runtime lost the option that injected it). These paths only exist to widen
32
+ // ModuleScopePlugin, so there is nothing to replace the regenerator entry with.
33
+ const babelRuntimeEntryHelpers = require.resolve('@babel/runtime/helpers/assertThisInitialized', { paths: [babelRuntimeEntry] });
38
34
 
39
35
  const extractCss = process.env.EXTRACT_CSS === 'true';
40
36
  const generateManifest = process.env.GENERATE_MANIFEST !== 'false';
@@ -306,7 +302,6 @@ const baseConfigFactory = (webpackEnv) => {
306
302
  reactRefreshWebpackPluginRuntimeEntry,
307
303
  babelRuntimeEntry,
308
304
  babelRuntimeEntryHelpers,
309
- babelRuntimeRegenerator,
310
305
  ]),
311
306
  ].filter(Boolean),
312
307
  },
@@ -371,7 +366,7 @@ const baseConfigFactory = (webpackEnv) => {
371
366
  include: paths.appPath,
372
367
  loader: require.resolve('babel-loader'),
373
368
  options: {
374
- customize: require.resolve('babel-preset-react-app/webpack-overrides'),
369
+ customize: require.resolve('./babel-webpack-overrides'),
375
370
  presets: [
376
371
  [
377
372
  require.resolve('./babel-preset-extended'),
@@ -389,10 +384,10 @@ const baseConfigFactory = (webpackEnv) => {
389
384
  // side of caution.
390
385
  // We remove this when the user ejects because the default
391
386
  // is sane and uses Babel options. Instead of options, we use
392
- // the react-unity-scripts and babel-preset-react-app versions.
387
+ // the react-unity-scripts and @babel/core versions.
393
388
  cacheIdentifier: getCacheIdentifier(isEnvProduction ? 'production' : isEnvDevelopment && 'development', [
394
389
  'babel-plugin-named-asset-import',
395
- 'babel-preset-react-app',
390
+ '@babel/core',
396
391
  'react-dev-utils',
397
392
  'react-unity-scripts',
398
393
  ]),
@@ -417,14 +412,14 @@ const baseConfigFactory = (webpackEnv) => {
417
412
  babelrc: true,
418
413
  configFile: true,
419
414
  compact: false,
420
- presets: [[require.resolve('babel-preset-react-app/dependencies'), { helpers: true }]],
415
+ presets: [[require.resolve('./babel-preset-dependencies'), { helpers: true }]],
421
416
  cacheDirectory: true,
422
417
  // See #6846 for context on why cacheCompression is disabled
423
418
  cacheCompression: false,
424
419
  // @remove-on-eject-begin
425
420
  cacheIdentifier: getCacheIdentifier(isEnvProduction ? 'production' : isEnvDevelopment && 'development', [
426
421
  'babel-plugin-named-asset-import',
427
- 'babel-preset-react-app',
422
+ '@babel/core',
428
423
  'react-dev-utils',
429
424
  'react-unity-scripts',
430
425
  ]),
@@ -517,7 +512,7 @@ const baseConfigFactory = (webpackEnv) => {
517
512
  // raw-loader is added by React Unity for its usefulness and for the sake of completion
518
513
  {
519
514
  test: /\.txt$/i,
520
- use: 'raw-loader',
515
+ use: require.resolve('raw-loader'),
521
516
  },
522
517
  // "file" loader makes sure those assets get served by WebpackDevServer.
523
518
  // When you `import` an asset, you get its (virtual) filename.
@@ -599,49 +594,20 @@ const baseConfigFactory = (webpackEnv) => {
599
594
  contextRegExp: /moment$/,
600
595
  }),
601
596
 
602
- // TypeScript type checking
603
- useTypeScript &&
604
- new ForkTsCheckerWebpackPlugin({
605
- async: isEnvDevelopment,
606
- typescript: {
607
- typescriptPath: resolve.sync('typescript', {
608
- basedir: paths.appNodeModules,
609
- }),
610
- configOverwrite: {
611
- compilerOptions: {
612
- sourceMap: isEnvProduction ? shouldUseSourceMap : isEnvDevelopment,
613
- skipLibCheck: true,
614
- inlineSourceMap: false,
615
- declarationMap: false,
616
- noEmit: true,
617
- incremental: true,
618
- tsBuildInfoFile: paths.appTsBuildInfoFile,
619
- },
620
- },
621
- context: paths.appPath,
622
- diagnosticOptions: {
623
- syntactic: true,
624
- },
625
- mode: 'write-references',
626
- // profile: true,
627
- },
628
- issue: {
629
- // This one is specifically to match during CI tests,
630
- // as micromatch doesn't match
631
- // '../cra-template-typescript/template/src/App.tsx'
632
- // otherwise.
633
- include: [{ file: '../**/src/**/*.{ts,tsx}' }, { file: '**/src/**/*.{ts,tsx}' }],
634
- exclude: [
635
- { file: '**/src/**/__tests__/**' },
636
- { file: '**/src/**/?(*.){spec|test}.*' },
637
- { file: '**/src/setupProxy.*' },
638
- { file: '**/src/setupTests.*' },
639
- ],
640
- },
641
- logger: {
642
- infrastructure: 'silent',
643
- },
644
- }),
597
+ // There is no type checking here on purpose.
598
+ //
599
+ // CRA ran fork-ts-checker-webpack-plugin alongside webpack so that `start` reported
600
+ // type errors and `build` failed on them. Babel strips types without checking, so
601
+ // that plugin was the only thing doing the checking -- but it needs TypeScript's JS
602
+ // API, which version 7 does not ship (its export map points `.` at lib/version.cjs,
603
+ // and `resolve.sync('typescript')` throws MODULE_NOT_FOUND). Keeping it meant keeping
604
+ // this package and every app built with it on TypeScript 6 indefinitely.
605
+ //
606
+ // So type checking moved out of the bundler and into its own command, the same split
607
+ // packages/* made when tsdown took over emitting: each app runs `tsc --noEmit` as
608
+ // `pnpm typecheck`, and CI runs it beside the build. `react-unity-scripts build` no
609
+ // longer fails on type errors, which is worth knowing if you are relying on it --
610
+ // run the two together.
645
611
  ].filter(Boolean),
646
612
  // Turn off performance processing because we utilize
647
613
  // our own hints via the FileSizeReporter
@@ -1,5 +1,3 @@
1
-
2
-
3
1
  const fs = require('node:fs');
4
2
  const path = require('node:path');
5
3
  const evalSourceMapMiddleware = require('react-dev-utils/evalSourceMapMiddleware');
@@ -15,15 +13,6 @@ const sockHost = process.env.WDS_SOCKET_HOST;
15
13
  const sockPath = process.env.WDS_SOCKET_PATH; // default: '/ws'
16
14
  const sockPort = process.env.WDS_SOCKET_PORT;
17
15
 
18
- function servePreviewerIfExists() {
19
- try {
20
- const previewerPath = path.dirname(require.resolve('@reactunity/previewer', { paths: [paths.appPath] }));
21
- console.log('Using @reactunity/previewer');
22
- return [{ directory: path.join(previewerPath, 'public') }];
23
- } catch (err) {}
24
- return [];
25
- }
26
-
27
16
  module.exports = (proxy, allowedHost) => {
28
17
  const disableFirewall = !proxy || process.env.DANGEROUSLY_DISABLE_HOST_CHECK === 'true';
29
18
  return {
@@ -81,17 +70,19 @@ module.exports = (proxy, allowedHost) => {
81
70
  },
82
71
  },
83
72
 
84
- // Serve previewer from local previewer directory
73
+ // A previewer the user built themselves, in a `previewer` folder in their project.
74
+ // Takes precedence over the built-in one below, and is the way to preview a custom
75
+ // scene or to work offline.
85
76
  {
86
77
  directory: paths.appPreviewer,
87
78
  publicPath: [paths.publicUrlOrPath],
88
79
  watch: { ignored: ignoredFiles(paths.appSrc) },
89
80
  },
90
81
 
91
- // If installed, serve the ReactUnity Web Previewer
92
- ...servePreviewerIfExists(),
93
-
94
- // Serve the fallback of web previewer as the index page
82
+ // The built-in previewer, last so anything above overrides it. Its Unity WebGL build
83
+ // is not here -- `public/index.html` loads it from reactunity.github.io. That used to
84
+ // be an optional `@reactunity/previewer` dependency serving its own `public` folder,
85
+ // which meant a ~107 MB install for a page most projects never opened.
95
86
  { directory: path.join(__dirname, 'public') },
96
87
  ],
97
88
  client: {
@@ -1,5 +1,8 @@
1
1
  /// <reference no-default-lib="true"/>
2
- /// <reference lib="es2021" />
2
+ // es2022, not es2021: ReactUnity's own code (the renderer's diffing, material's
3
+ // virtual-scroll, the devtools app) calls Object.hasOwn, and every engine ReactUnity
4
+ // ships with -- QuickJS, Jint 3, ClearScript -- implements it.
5
+ /// <reference lib="es2022" />
3
6
  /// <reference types="react" />
4
7
  /// <reference types="webpack-env" />
5
8
 
@@ -54,6 +57,14 @@ declare module '*.svg' {
54
57
  export default src;
55
58
  }
56
59
 
60
+ // Plain stylesheets, imported for their side effects (`import './globals.scss'`). These
61
+ // have no exports to describe, but they do have to be declared: TypeScript 6 reports a
62
+ // side-effect import of an unresolvable module as an error (TS2882) where earlier versions
63
+ // let it through.
64
+ declare module '*.css';
65
+ declare module '*.scss';
66
+ declare module '*.sass';
67
+
57
68
  declare module '*.module.css' {
58
69
  const classes: { readonly [key: string]: string };
59
70
  export default classes;
package/package.json CHANGED
@@ -1,17 +1,18 @@
1
1
  {
2
2
  "name": "@reactunity/scripts",
3
- "version": "0.20.1",
3
+ "version": "0.23.0",
4
4
  "description": "Configuration and scripts for React Unity.",
5
5
  "repository": {
6
6
  "type": "git",
7
- "url": "https://github.com/ReactUnity/scripts.git"
7
+ "url": "git+https://github.com/ReactUnity/core.git",
8
+ "directory": "packages/scripts"
8
9
  },
9
10
  "license": "MIT",
10
11
  "engines": {
11
12
  "node": ">=14.0.0"
12
13
  },
13
14
  "bugs": {
14
- "url": "https://github.com/ReactUnity/scripts/issues"
15
+ "url": "https://github.com/ReactUnity/core/issues"
15
16
  },
16
17
  "files": [
17
18
  "bin",
@@ -45,31 +46,34 @@
45
46
  },
46
47
  "tsconfig": "./tsconfig.json",
47
48
  "dependencies": {
48
- "@babel/core": "^7.27.4",
49
- "@babel/plugin-proposal-private-property-in-object": "^7.21.11",
50
- "@babel/preset-react": "^7.27.1",
49
+ "@babel/core": "^8.0.1",
50
+ "@babel/plugin-transform-runtime": "^8.0.1",
51
+ "@babel/preset-env": "^8.0.2",
52
+ "@babel/preset-react": "^8.0.1",
53
+ "@babel/preset-typescript": "^8.0.1",
54
+ "@babel/runtime": "^8.0.0",
51
55
  "@pmmmwh/react-refresh-webpack-plugin": "^0.6.0",
52
56
  "@svgr/webpack": "^8.1.0",
53
- "@types/react": "^19.1.8",
57
+ "@types/react": "^19.2.17",
54
58
  "@types/webpack-env": "^1.18.8",
55
59
  "babel-jest": "^30.0.2",
56
60
  "babel-loader": "^10.0.0",
61
+ "babel-plugin-macros": "^3.1.0",
57
62
  "babel-plugin-named-asset-import": "^0.3.8",
58
- "babel-preset-react-app": "^10.1.0",
59
63
  "bfj": "^9.1.2",
60
- "camelcase": "^8.0.0",
64
+ "camelcase": "^9.0.0",
61
65
  "case-sensitive-paths-webpack-plugin": "^2.4.0",
62
66
  "confusing-browser-globals": "^1.0.11",
63
67
  "css-loader": "^7.1.2",
64
- "dotenv": "^16.5.0",
65
- "dotenv-expand": "^12.0.2",
68
+ "dotenv": "^17.4.2",
69
+ "dotenv-expand": "^13.0.0",
66
70
  "file-loader": "^6.2.0",
67
- "fork-ts-checker-webpack-plugin": "^9.1.0",
68
71
  "fs-extra": "^11.3.0",
69
72
  "identity-obj-proxy": "^3.0.0",
70
73
  "jest": "^30.0.3",
71
74
  "jest-resolve": "^30.0.2",
72
75
  "jest-watch-typeahead": "^3.0.1",
76
+ "jsonc-parser": "^3.3.1",
73
77
  "mini-css-extract-plugin": "^2.9.2",
74
78
  "null-loader": "^4.0.1",
75
79
  "postcss": "^8.5.6",
@@ -78,11 +82,11 @@
78
82
  "raw-loader": "^4.0.2",
79
83
  "react-app-polyfill": "^3.0.0",
80
84
  "react-dev-utils": "^12.0.1",
81
- "react-refresh": "^0.17.0",
85
+ "react-refresh": "^0.18.0",
82
86
  "resolve": "^1.22.10",
83
87
  "resolve-url-loader": "^5.0.0",
84
88
  "sass": "^1.89.2",
85
- "sass-loader": "^16.0.5",
89
+ "sass-loader": "^17.0.0",
86
90
  "semver": "^7.7.2",
87
91
  "source-map-loader": "^5.0.0",
88
92
  "style-loader": "^4.0.0",
@@ -90,27 +94,27 @@
90
94
  "terser-webpack-plugin": "^5.3.14",
91
95
  "url-loader": "^4.1.1",
92
96
  "webpack": "^5.99.9",
93
- "webpack-dev-server": "^5.2.2",
94
- "webpack-manifest-plugin": "^5.0.1"
97
+ "webpack-dev-server": "^6.0.0",
98
+ "webpack-manifest-plugin": "^6.0.1"
95
99
  },
96
100
  "devDependencies": {
97
- "typescript": "^5.8.3"
101
+ "typescript": "^7.0.2"
98
102
  },
99
103
  "optionalDependencies": {
100
104
  "fsevents": "^2.3.3"
101
105
  },
102
106
  "peerDependencies": {
103
- "@reactunity/previewer": "*",
104
107
  "@reactunity/renderer": ">=0.20.0",
105
108
  "react": "^19.0.0",
106
109
  "typescript": ">=5"
107
110
  },
108
111
  "peerDependenciesMeta": {
109
- "@reactunity/previewer": {
110
- "optional": true
111
- },
112
112
  "typescript": {
113
113
  "optional": true
114
114
  }
115
+ },
116
+ "homepage": "https://github.com/ReactUnity/core/tree/main/packages/scripts#readme",
117
+ "publishConfig": {
118
+ "access": "public"
115
119
  }
116
- }
120
+ }
package/scripts/build.js CHANGED
@@ -82,15 +82,14 @@ checkBrowsers(paths.appPath, isInteractive)
82
82
  console.log(`The ${chalk.blue(buildFolder)} folder is ready to be used in ReactUnity.`);
83
83
  },
84
84
  (err) => {
85
- const tscCompileOnError = process.env.TSC_COMPILE_ON_ERROR === 'true';
86
- if (tscCompileOnError) {
87
- console.log(chalk.yellow('Compiled with the following type errors (you may want to check these before deploying your app):\n'));
88
- printBuildError(err);
89
- } else {
90
- console.log(chalk.red('Failed to compile.\n'));
91
- printBuildError(err);
92
- process.exit(1);
93
- }
85
+ // TSC_COMPILE_ON_ERROR used to be honoured here: it downgraded the failure to a
86
+ // warning and let the build through, which made sense when the errors arriving on this
87
+ // path could be *type* errors from fork-ts-checker. That plugin is gone (see
88
+ // config/webpack.config.js), so anything reaching here is a real build failure and
89
+ // there is nothing left for the flag to usefully excuse.
90
+ console.log(chalk.red('Failed to compile.\n'));
91
+ printBuildError(err);
92
+ process.exit(1);
94
93
  },
95
94
  )
96
95
  .catch((err) => {
@@ -116,7 +115,7 @@ function build(previousFileSizes) {
116
115
  let errMessage = err.message;
117
116
 
118
117
  // Add additional information for postcss errors
119
- if (Object.prototype.hasOwnProperty.call(err, 'postcssNode')) {
118
+ if (Object.hasOwn(err, 'postcssNode')) {
120
119
  errMessage += `\nCompileError: Begins at CSS selector ${err.postcssNode.selector}`;
121
120
  }
122
121
 
package/scripts/init.js CHANGED
@@ -12,7 +12,6 @@ const execSync = require('node:child_process').execSync;
12
12
  const spawn = require('react-dev-utils/crossSpawn');
13
13
  const { defaultBrowsers } = require('react-dev-utils/browsersHelper');
14
14
  const os = require('node:os');
15
- const verifyTypeScriptSetup = require('./utils/verifyTypeScriptSetup');
16
15
 
17
16
  function isInGitRepository() {
18
17
  try {
@@ -276,10 +275,15 @@ module.exports = (appPath, appName, verbose, originalDirectory, templateName) =>
276
275
  }
277
276
  }
278
277
 
279
- if (args.find((arg) => arg.includes('typescript'))) {
280
- console.log();
281
- verifyTypeScriptSetup();
282
- }
278
+ // CRA called verifyTypeScriptSetup() here, which rewrote the new project's tsconfig.json
279
+ // with the options it expected. It was deleted along with the rest of this package's
280
+ // dependence on the TypeScript JS API: it drove the compiler through
281
+ // ts.parseJsonConfigFileContent/ts.JsxEmit/ts.ScriptTarget, which TypeScript 7 does not
282
+ // expose, and what it wrote included `target: ES5` -- an option 7 removed. Nothing
283
+ // reaches this file in the first place: `init` is not one of the scripts bin/
284
+ // react-unity-scripts.js dispatches (build, eject, start, test, clean), and project
285
+ // creation goes through @reactunity/create, which copies packages/create/scaffold
286
+ // wholesale -- tsconfig.json included, already correct.
283
287
 
284
288
  // Remove template
285
289
  console.log(`Removing template package using ${command}...`);
package/scripts/start.js CHANGED
@@ -103,7 +103,16 @@ checkBrowsers(paths.appPath, isInteractive)
103
103
  };
104
104
  const devServer = new WebpackDevServer(serverConfig, compiler);
105
105
  // Launch WebpackDevServer.
106
- devServer.startCallback(() => {
106
+ devServer.startCallback((err) => {
107
+ // The callback used to take no arguments, which meant anything that went wrong while
108
+ // the server came up was dropped: the failure looked like "Starting the development
109
+ // server..." followed by silence, with nothing listening. Report it instead.
110
+ if (err) {
111
+ console.log(chalk.red('Failed to start the development server.\n'));
112
+ console.log(err.message || err);
113
+ process.exit(1);
114
+ }
115
+
107
116
  if (isInteractive) {
108
117
  clearConsole();
109
118
  }
@@ -70,7 +70,7 @@ module.exports = (resolve, rootDir, isEjecting) => {
70
70
  ];
71
71
  if (overrides) {
72
72
  supportedKeys.forEach((key) => {
73
- if (Object.prototype.hasOwnProperty.call(overrides, key)) {
73
+ if (Object.hasOwn(overrides, key)) {
74
74
  if (Array.isArray(config[key]) || typeof config[key] !== 'object') {
75
75
  // for arrays or primitive types, directly override the config key
76
76
  config[key] = overrides[key];
package/tsconfig.json CHANGED
@@ -7,7 +7,7 @@
7
7
  "declaration": false,
8
8
  "module": "ESNext",
9
9
  "moduleResolution": "Bundler",
10
- "preserveSymlinks": true,
10
+ "preserveSymlinks": false,
11
11
  "importHelpers": false,
12
12
  "strict": true,
13
13
  "strictNullChecks": false,