Skip to content
This repository was archived by the owner on Jul 25, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions packages/react-scripts/README-imodeljs.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,15 @@ Current upstream with `react-scripts@3.4.1`.

> Note: These configuration variables are an extension of the [Advanced Configurations](create-react-app.dev/docs/advanced-configuration) supported by create-react-app.

| Variable | Development | Production | Usage |
| ----------------------- | ----------- | ---------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| USE_FAST_SASS | ✅ Used | ✅ Used | When set to `true`, use the fast-sass-loader instead of sass-loader. This helps with long build times on smaller machines attempting to build an app with a large amount of scss/sass files. |
| DEBUG_BUILD_PERFORMANCE | ✅ Used | 🚫 Ignored | When set to `true`, reports webpack build performance and bottlenecks. Uses the [speed measure webpack plugin](https://www.npmjs.com/package/speed-measure-webpack-plugin). |
| USE_FULL_SOURCEMAP | ✅ Used | 🚫 Ignored | When set to `true`, the sourcemaps generated use 'source-map' instead of 'cheap-module-source-map'. This is known to cause out-of-memory errors but gives full fidelity source maps in debug builds. |
| DISABLE_ESLINT | ✅ Used | ✅ Used | When set to `true`, webpack will not run eslint at all. This can speedup builds when you want to keep build and lint as separate steps. |
| TRANSPILE_DEPS | ✅ Used | ✅ Used | When set to `false`, webpack will not run babel on anything in node_modules. Transpiling dependencies can be costly, and is often not necessary when targeting newer browsers. |
| DISABLE_TERSER | 🚫 Ignored | ✅ Used | When set to `true`, skips all minification. Useful for PR builds and test apps. |
| Variable | Development | Production | Usage |
| ----------------------- | ----------- | ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| USE_FAST_SASS | ✅ Used | ✅ Used | When set to `true`, use the fast-sass-loader instead of sass-loader. This helps with long build times on smaller machines attempting to build an app with a large amount of scss/sass files. |
| DEBUG_BUILD_PERFORMANCE | ✅ Used | 🚫 Ignored | When set to `true`, reports webpack build performance and bottlenecks. Uses the [speed measure webpack plugin](https://www.npmjs.com/package/speed-measure-webpack-plugin). |
| USE_FULL_SOURCEMAP | ✅ Used | 🚫 Ignored | When set to `true`, the sourcemaps generated use 'source-map' instead of 'cheap-module-source-map'. This is known to cause out-of-memory errors but gives full fidelity source maps in debug builds. |
| DISABLE_ESLINT | ✅ Used | ✅ Used | When set to `true`, webpack will not run eslint at all. This can speedup builds when you want to keep build and lint as separate steps. |
| TRANSPILE_DEPS | ✅ Used | ✅ Used | When set to `false`, webpack will not run babel on anything in node_modules. Transpiling dependencies can be costly, and is often not necessary when targeting newer browsers. |
| DISABLE_TERSER | 🚫 Ignored | ✅ Used | When set to `true`, skips all minification. Useful for PR builds and test apps. |
| DISABLE_NEW_ASSET_COPY | ✅ Used | ✅ Used | When set to `true`, disables the new copy static assets plugin which copies all files from dependencies starting with `@bentley` or `@itwin` scope. In addition it makes them available to both a `build` and `start` scripts. Note: There is a bug with the new asset copy when used with pnpm or yarn workspaces. |

- Typing changes

Expand Down
7 changes: 6 additions & 1 deletion packages/react-scripts/config/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ const FilterWarningsPlugin = require('webpack-filter-warnings-plugin');

const {
BanBackendImportsPlugin,
CopyBentleyStaticResourcesPlugin,
CopyStaticAssetsPlugin,
IModeljsLibraryExportsPlugin,
} = require('@bentley/webpack-tools-core');
Expand All @@ -66,6 +67,8 @@ const shouldTranspileDeps = process.env.TRANSPILE_DEPS !== 'false';

const shouldMinify = process.env.DISABLE_TERSER !== 'true';

const disableNewAssetCopy = process.env.DISABLE_NEW_ASSET_COPY === 'true';

// End iModel.js Changes block

// Source maps are resource heavy and can cause out of memory issue for large source files.
Expand Down Expand Up @@ -698,7 +701,9 @@ module.exports = function(webpackEnv) {
// NOTE: iModel.js specific plugin to copy a set of static resources from the node_modules
// directory of each dependent package into the 'build/public' directory.
// Used for resources such as locales, which are defined by each consuming package.
new CopyStaticAssetsPlugin({}),
disableNewAssetCopy
Comment thread
aruniverse marked this conversation as resolved.
? new CopyBentleyStaticResourcesPlugin(['public'], true)
: new CopyStaticAssetsPlugin({}),

// NOTE: FilterWarningsPlugin is used to ignore warning coming from sourcemaps
new FilterWarningsPlugin({ exclude: /Failed to parse source map/ }),
Expand Down
2 changes: 1 addition & 1 deletion packages/react-scripts/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@bentley/react-scripts",
"version": "3.4.12",
"version": "3.4.13",
"description": "iModel.js configuration and scripts for Create React App.",
"repository": {
"type": "git",
Expand Down