Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

3 лет назад
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580
  1. // @remove-on-eject-begin
  2. /**
  3. * Copyright (c) 2015-present, Facebook, Inc.
  4. *
  5. * This source code is licensed under the MIT license found in the
  6. * LICENSE file in the root directory of this source tree.
  7. */
  8. // @remove-on-eject-end
  9. 'use strict';
  10. const fs = require('fs');
  11. const path = require('path');
  12. const webpack = require('webpack');
  13. const resolve = require('resolve');
  14. const PnpWebpackPlugin = require('pnp-webpack-plugin');
  15. const HtmlWebpackPlugin = require('html-webpack-plugin');
  16. const InlineChunkHtmlPlugin = require('react-dev-utils/InlineChunkHtmlPlugin');
  17. const TerserPlugin = require('terser-webpack-plugin');
  18. const MiniCssExtractPlugin = require('mini-css-extract-plugin');
  19. const OptimizeCSSAssetsPlugin = require('optimize-css-assets-webpack-plugin');
  20. const safePostCssParser = require('postcss-safe-parser');
  21. const ManifestPlugin = require('webpack-manifest-plugin');
  22. const InterpolateHtmlPlugin = require('react-dev-utils/InterpolateHtmlPlugin');
  23. const WorkboxWebpackPlugin = require('workbox-webpack-plugin');
  24. const ModuleScopePlugin = require('react-dev-utils/ModuleScopePlugin');
  25. const getCSSModuleLocalIdent = require('react-dev-utils/getCSSModuleLocalIdent');
  26. const paths = require('./paths');
  27. const getClientEnvironment = require('./env');
  28. const ModuleNotFoundPlugin = require('react-dev-utils/ModuleNotFoundPlugin');
  29. const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin-alt');
  30. const typescriptFormatter = require('react-dev-utils/typescriptFormatter');
  31. // @remove-on-eject-begin
  32. const getCacheIdentifier = require('react-dev-utils/getCacheIdentifier');
  33. // @remove-on-eject-end
  34. // Webpack uses `publicPath` to determine where the app is being served from.
  35. // It requires a trailing slash, or the file assets will get an incorrect path.
  36. const publicPath = paths.servedPath;
  37. // Some apps do not use client-side routing with pushState.
  38. // For these, "homepage" can be set to "." to enable relative asset paths.
  39. const shouldUseRelativeAssetPaths = publicPath === './';
  40. // Source maps are resource heavy and can cause out of memory issue for large source files.
  41. const shouldUseSourceMap = process.env.GENERATE_SOURCEMAP !== 'false';
  42. // Some apps do not need the benefits of saving a web request, so not inlining the chunk
  43. // makes for a smoother build process.
  44. const shouldInlineRuntimeChunk = process.env.INLINE_RUNTIME_CHUNK !== 'false';
  45. // `publicUrl` is just like `publicPath`, but we will provide it to our app
  46. // as %PUBLIC_URL% in `index.html` and `process.env.PUBLIC_URL` in JavaScript.
  47. // Omit trailing slash as %PUBLIC_URL%/xyz looks better than %PUBLIC_URL%xyz.
  48. const publicUrl = publicPath.slice(0, -1);
  49. // Get environment variables to inject into our app.
  50. const env = getClientEnvironment(publicUrl);
  51. // Assert this just to be safe.
  52. // Development builds of React are slow and not intended for production.
  53. if (env.stringified['process.env'].NODE_ENV !== '"production"') {
  54. throw new Error('Production builds must have NODE_ENV=production.');
  55. }
  56. // Check if TypeScript is setup
  57. const useTypeScript = fs.existsSync(paths.appTsConfig);
  58. // style files regexes
  59. const cssRegex = /\.css$/;
  60. const cssModuleRegex = /\.module\.css$/;
  61. const sassRegex = /\.(scss|sass)$/;
  62. const sassModuleRegex = /\.module\.(scss|sass)$/;
  63. // common function to get style loaders
  64. const getStyleLoaders = (cssOptions, preProcessor) => {
  65. const loaders = [
  66. {
  67. loader: MiniCssExtractPlugin.loader,
  68. options: Object.assign(
  69. {},
  70. shouldUseRelativeAssetPaths ? { publicPath: '../../' } : undefined
  71. ),
  72. },
  73. {
  74. loader: require.resolve('css-loader'),
  75. options: cssOptions,
  76. },
  77. {
  78. // Options for PostCSS as we reference these options twice
  79. // Adds vendor prefixing based on your specified browser support in
  80. // package.json
  81. loader: require.resolve('postcss-loader'),
  82. options: {
  83. // Necessary for external CSS imports to work
  84. // https://github.com/facebook/create-react-app/issues/2677
  85. ident: 'postcss',
  86. plugins: () => [
  87. require('postcss-flexbugs-fixes'),
  88. require('postcss-preset-env')({
  89. autoprefixer: {
  90. flexbox: 'no-2009',
  91. },
  92. stage: 3,
  93. }),
  94. ],
  95. sourceMap: shouldUseSourceMap,
  96. },
  97. },
  98. ];
  99. if (preProcessor) {
  100. loaders.push({
  101. loader: require.resolve(preProcessor),
  102. options: {
  103. sourceMap: shouldUseSourceMap,
  104. },
  105. });
  106. }
  107. return loaders;
  108. };
  109. // This is the production configuration.
  110. // It compiles slowly and is focused on producing a fast and minimal bundle.
  111. // The development configuration is different and lives in a separate file.
  112. module.exports = {
  113. mode: 'production',
  114. // Don't attempt to continue if there are any errors.
  115. bail: true,
  116. // We generate sourcemaps in production. This is slow but gives good results.
  117. // You can exclude the *.map files from the build during deployment.
  118. devtool: shouldUseSourceMap ? 'source-map' : false,
  119. // In production, we only want to load the app code.
  120. entry: [paths.appIndexJs],
  121. output: {
  122. // The build folder.
  123. path: paths.appBuild,
  124. // Generated JS file names (with nested folders).
  125. // There will be one main bundle, and one file per asynchronous chunk.
  126. // We don't currently advertise code splitting but Webpack supports it.
  127. filename: 'static/js/[name].[chunkhash:8].js',
  128. chunkFilename: 'static/js/[name].[chunkhash:8].chunk.js',
  129. // We inferred the "public path" (such as / or /my-project) from homepage.
  130. publicPath: publicPath,
  131. // Point sourcemap entries to original disk location (format as URL on Windows)
  132. devtoolModuleFilenameTemplate: info =>
  133. path
  134. .relative(paths.appSrc, info.absoluteResourcePath)
  135. .replace(/\\/g, '/'),
  136. },
  137. optimization: {
  138. minimizer: [
  139. new TerserPlugin({
  140. terserOptions: {
  141. parse: {
  142. // we want terser to parse ecma 8 code. However, we don't want it
  143. // to apply any minfication steps that turns valid ecma 5 code
  144. // into invalid ecma 5 code. This is why the 'compress' and 'output'
  145. // sections only apply transformations that are ecma 5 safe
  146. // https://github.com/facebook/create-react-app/pull/4234
  147. ecma: 8,
  148. },
  149. compress: {
  150. ecma: 5,
  151. warnings: false,
  152. // Disabled because of an issue with Uglify breaking seemingly valid code:
  153. // https://github.com/facebook/create-react-app/issues/2376
  154. // Pending further investigation:
  155. // https://github.com/mishoo/UglifyJS2/issues/2011
  156. comparisons: false,
  157. // Disabled because of an issue with Terser breaking valid code:
  158. // https://github.com/facebook/create-react-app/issues/5250
  159. // Pending futher investigation:
  160. // https://github.com/terser-js/terser/issues/120
  161. inline: 2,
  162. },
  163. mangle: {
  164. safari10: true,
  165. },
  166. output: {
  167. ecma: 5,
  168. comments: false,
  169. // Turned on because emoji and regex is not minified properly using default
  170. // https://github.com/facebook/create-react-app/issues/2488
  171. ascii_only: true,
  172. },
  173. },
  174. // Use multi-process parallel running to improve the build speed
  175. // Default number of concurrent runs: os.cpus().length - 1
  176. parallel: true,
  177. // Enable file caching
  178. cache: true,
  179. sourceMap: shouldUseSourceMap,
  180. }),
  181. new OptimizeCSSAssetsPlugin({
  182. cssProcessorOptions: {
  183. parser: safePostCssParser,
  184. map: shouldUseSourceMap
  185. ? {
  186. // `inline: false` forces the sourcemap to be output into a
  187. // separate file
  188. inline: false,
  189. // `annotation: true` appends the sourceMappingURL to the end of
  190. // the css file, helping the browser find the sourcemap
  191. annotation: true,
  192. }
  193. : false,
  194. },
  195. }),
  196. ],
  197. // Automatically split vendor and commons
  198. // https://twitter.com/wSokra/status/969633336732905474
  199. // https://medium.com/webpack/webpack-4-code-splitting-chunk-graph-and-the-splitchunks-optimization-be739a861366
  200. splitChunks: {
  201. chunks: 'all',
  202. name: false,
  203. },
  204. // Keep the runtime chunk seperated to enable long term caching
  205. // https://twitter.com/wSokra/status/969679223278505985
  206. runtimeChunk: true,
  207. },
  208. resolve: {
  209. // This allows you to set a fallback for where Webpack should look for modules.
  210. // We placed these paths second because we want `node_modules` to "win"
  211. // if there are any conflicts. This matches Node resolution mechanism.
  212. // https://github.com/facebook/create-react-app/issues/253
  213. modules: ['node_modules'].concat(
  214. // It is guaranteed to exist because we tweak it in `env.js`
  215. process.env.NODE_PATH.split(path.delimiter).filter(Boolean)
  216. ),
  217. // These are the reasonable defaults supported by the Node ecosystem.
  218. // We also include JSX as a common component filename extension to support
  219. // some tools, although we do not recommend using it, see:
  220. // https://github.com/facebook/create-react-app/issues/290
  221. // `web` extension prefixes have been added for better support
  222. // for React Native Web.
  223. extensions: paths.moduleFileExtensions
  224. .map(ext => `.${ext}`)
  225. .filter(ext => useTypeScript || !ext.includes('ts')),
  226. alias: {
  227. // Support React Native Web
  228. // https://www.smashingmagazine.com/2016/08/a-glimpse-into-the-future-with-react-native-for-web/
  229. 'react-native': 'react-native-web',
  230. },
  231. plugins: [
  232. // Adds support for installing with Plug'n'Play, leading to faster installs and adding
  233. // guards against forgotten dependencies and such.
  234. PnpWebpackPlugin,
  235. // Prevents users from importing files from outside of src/ (or node_modules/).
  236. // This often causes confusion because we only process files within src/ with babel.
  237. // To fix this, we prevent you from importing files out of src/ -- if you'd like to,
  238. // please link the files into your node_modules/ and let module-resolution kick in.
  239. // Make sure your source files are compiled, as they will not be processed in any way.
  240. new ModuleScopePlugin(paths.appSrc, [paths.appPackageJson]),
  241. ],
  242. },
  243. resolveLoader: {
  244. plugins: [
  245. // Also related to Plug'n'Play, but this time it tells Webpack to load its loaders
  246. // from the current package.
  247. PnpWebpackPlugin.moduleLoader(module),
  248. ],
  249. },
  250. module: {
  251. strictExportPresence: true,
  252. rules: [
  253. // Disable require.ensure as it's not a standard language feature.
  254. { parser: { requireEnsure: false } },
  255. // First, run the linter.
  256. // It's important to do this before Babel processes the JS.
  257. {
  258. test: /\.(js|mjs|jsx)$/,
  259. enforce: 'pre',
  260. use: [
  261. {
  262. options: {
  263. formatter: require.resolve('react-dev-utils/eslintFormatter'),
  264. eslintPath: require.resolve('eslint'),
  265. // @remove-on-eject-begin
  266. // TODO: consider separate config for production,
  267. // e.g. to enable no-console and no-debugger only in production.
  268. baseConfig: {
  269. extends: [require.resolve('eslint-config-react-app')],
  270. settings: { react: { version: '999.999.999' } },
  271. },
  272. ignore: false,
  273. useEslintrc: false,
  274. // @remove-on-eject-end
  275. },
  276. loader: require.resolve('eslint-loader'),
  277. },
  278. ],
  279. include: paths.appSrc,
  280. },
  281. {
  282. // "oneOf" will traverse all following loaders until one will
  283. // match the requirements. When no loader matches it will fall
  284. // back to the "file" loader at the end of the loader list.
  285. oneOf: [
  286. // "url" loader works just like "file" loader but it also embeds
  287. // assets smaller than specified size as data URLs to avoid requests.
  288. {
  289. test: [/\.bmp$/, /\.gif$/, /\.jpe?g$/, /\.png$/],
  290. loader: require.resolve('url-loader'),
  291. options: {
  292. limit: 10000,
  293. name: 'static/media/[name].[hash:8].[ext]',
  294. },
  295. },
  296. // Process application JS with Babel.
  297. // The preset includes JSX, Flow, TypeScript and some ESnext features.
  298. {
  299. test: /\.(js|mjs|jsx|ts|tsx)$/,
  300. include: paths.appSrc,
  301. loader: require.resolve('babel-loader'),
  302. options: {
  303. customize: require.resolve(
  304. 'babel-preset-react-app/webpack-overrides'
  305. ),
  306. // @remove-on-eject-begin
  307. babelrc: false,
  308. configFile: false,
  309. presets: [require.resolve('babel-preset-react-app')],
  310. // Make sure we have a unique cache identifier, erring on the
  311. // side of caution.
  312. // We remove this when the user ejects because the default
  313. // is sane and uses Babel options. Instead of options, we use
  314. // the react-scripts and babel-preset-react-app versions.
  315. cacheIdentifier: getCacheIdentifier('production', [
  316. 'babel-plugin-named-asset-import',
  317. 'babel-preset-react-app',
  318. 'react-dev-utils',
  319. 'react-scripts',
  320. ]),
  321. // @remove-on-eject-end
  322. plugins: [
  323. [
  324. require.resolve('babel-plugin-named-asset-import'),
  325. {
  326. loaderMap: {
  327. svg: {
  328. ReactComponent: '@svgr/webpack?-prettier,-svgo![path]',
  329. },
  330. },
  331. },
  332. ],
  333. ],
  334. cacheDirectory: true,
  335. // Save disk space when time isn't as important
  336. cacheCompression: true,
  337. compact: true,
  338. },
  339. },
  340. // Process any JS outside of the app with Babel.
  341. // Unlike the application JS, we only compile the standard ES features.
  342. {
  343. test: /\.(js|mjs)$/,
  344. exclude: /@babel(?:\/|\\{1,2})runtime/,
  345. loader: require.resolve('babel-loader'),
  346. options: {
  347. babelrc: false,
  348. configFile: false,
  349. compact: false,
  350. presets: [
  351. [
  352. require.resolve('babel-preset-react-app/dependencies'),
  353. { helpers: true },
  354. ],
  355. ],
  356. cacheDirectory: true,
  357. // Save disk space when time isn't as important
  358. cacheCompression: true,
  359. // @remove-on-eject-begin
  360. cacheIdentifier: getCacheIdentifier('production', [
  361. 'babel-plugin-named-asset-import',
  362. 'babel-preset-react-app',
  363. 'react-dev-utils',
  364. 'react-scripts',
  365. ]),
  366. // @remove-on-eject-end
  367. // If an error happens in a package, it's possible to be
  368. // because it was compiled. Thus, we don't want the browser
  369. // debugger to show the original code. Instead, the code
  370. // being evaluated would be much more helpful.
  371. sourceMaps: false,
  372. },
  373. },
  374. // "postcss" loader applies autoprefixer to our CSS.
  375. // "css" loader resolves paths in CSS and adds assets as dependencies.
  376. // `MiniCSSExtractPlugin` extracts styles into CSS
  377. // files. If you use code splitting, async bundles will have their own separate CSS chunk file.
  378. // By default we support CSS Modules with the extension .module.css
  379. {
  380. test: cssRegex,
  381. exclude: cssModuleRegex,
  382. loader: getStyleLoaders({
  383. importLoaders: 1,
  384. sourceMap: shouldUseSourceMap,
  385. }),
  386. // Don't consider CSS imports dead code even if the
  387. // containing package claims to have no side effects.
  388. // Remove this when webpack adds a warning or an error for this.
  389. // See https://github.com/webpack/webpack/issues/6571
  390. sideEffects: true,
  391. },
  392. // Adds support for CSS Modules (https://github.com/css-modules/css-modules)
  393. // using the extension .module.css
  394. {
  395. test: cssModuleRegex,
  396. loader: getStyleLoaders({
  397. importLoaders: 1,
  398. sourceMap: shouldUseSourceMap,
  399. modules: true,
  400. getLocalIdent: getCSSModuleLocalIdent,
  401. }),
  402. },
  403. // Opt-in support for SASS. The logic here is somewhat similar
  404. // as in the CSS routine, except that "sass-loader" runs first
  405. // to compile SASS files into CSS.
  406. // By default we support SASS Modules with the
  407. // extensions .module.scss or .module.sass
  408. {
  409. test: sassRegex,
  410. exclude: sassModuleRegex,
  411. loader: getStyleLoaders(
  412. {
  413. importLoaders: 2,
  414. sourceMap: shouldUseSourceMap,
  415. },
  416. 'sass-loader'
  417. ),
  418. // Don't consider CSS imports dead code even if the
  419. // containing package claims to have no side effects.
  420. // Remove this when webpack adds a warning or an error for this.
  421. // See https://github.com/webpack/webpack/issues/6571
  422. sideEffects: true,
  423. },
  424. // Adds support for CSS Modules, but using SASS
  425. // using the extension .module.scss or .module.sass
  426. {
  427. test: sassModuleRegex,
  428. loader: getStyleLoaders(
  429. {
  430. importLoaders: 2,
  431. sourceMap: shouldUseSourceMap,
  432. modules: true,
  433. getLocalIdent: getCSSModuleLocalIdent,
  434. },
  435. 'sass-loader'
  436. ),
  437. },
  438. // "file" loader makes sure assets end up in the `build` folder.
  439. // When you `import` an asset, you get its filename.
  440. // This loader doesn't use a "test" so it will catch all modules
  441. // that fall through the other loaders.
  442. {
  443. loader: require.resolve('file-loader'),
  444. // Exclude `js` files to keep "css" loader working as it injects
  445. // it's runtime that would otherwise be processed through "file" loader.
  446. // Also exclude `html` and `json` extensions so they get processed
  447. // by webpacks internal loaders.
  448. exclude: [/\.(js|mjs|jsx|ts|tsx)$/, /\.html$/, /\.json$/],
  449. options: {
  450. name: 'static/media/[name].[hash:8].[ext]',
  451. },
  452. },
  453. // ** STOP ** Are you adding a new loader?
  454. // Make sure to add the new loader(s) before the "file" loader.
  455. ],
  456. },
  457. ],
  458. },
  459. plugins: [
  460. // Generates an `index.html` file with the <script> injected.
  461. new HtmlWebpackPlugin({
  462. inject: true,
  463. template: paths.appHtml,
  464. minify: {
  465. removeComments: true,
  466. collapseWhitespace: true,
  467. removeRedundantAttributes: true,
  468. useShortDoctype: true,
  469. removeEmptyAttributes: true,
  470. removeStyleLinkTypeAttributes: true,
  471. keepClosingSlash: true,
  472. minifyJS: true,
  473. minifyCSS: true,
  474. minifyURLs: true,
  475. },
  476. }),
  477. // Inlines the webpack runtime script. This script is too small to warrant
  478. // a network request.
  479. shouldInlineRuntimeChunk &&
  480. new InlineChunkHtmlPlugin(HtmlWebpackPlugin, [/runtime~.+[.]js/]),
  481. // Makes some environment variables available in index.html.
  482. // The public URL is available as %PUBLIC_URL% in index.html, e.g.:
  483. // <link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico">
  484. // In production, it will be an empty string unless you specify "homepage"
  485. // in `package.json`, in which case it will be the pathname of that URL.
  486. new InterpolateHtmlPlugin(HtmlWebpackPlugin, env.raw),
  487. // This gives some necessary context to module not found errors, such as
  488. // the requesting resource.
  489. new ModuleNotFoundPlugin(paths.appPath),
  490. // Makes some environment variables available to the JS code, for example:
  491. // if (process.env.NODE_ENV === 'production') { ... }. See `./env.js`.
  492. // It is absolutely essential that NODE_ENV was set to production here.
  493. // Otherwise React will be compiled in the very slow development mode.
  494. new webpack.DefinePlugin(env.stringified),
  495. new MiniCssExtractPlugin({
  496. // Options similar to the same options in webpackOptions.output
  497. // both options are optional
  498. filename: 'static/css/[name].[contenthash:8].css',
  499. chunkFilename: 'static/css/[name].[contenthash:8].chunk.css',
  500. }),
  501. // Generate a manifest file which contains a mapping of all asset filenames
  502. // to their corresponding output file so that tools can pick it up without
  503. // having to parse `index.html`.
  504. new ManifestPlugin({
  505. fileName: 'asset-manifest.json',
  506. publicPath: publicPath,
  507. }),
  508. // Moment.js is an extremely popular library that bundles large locale files
  509. // by default due to how Webpack interprets its code. This is a practical
  510. // solution that requires the user to opt into importing specific locales.
  511. // https://github.com/jmblog/how-to-optimize-momentjs-with-webpack
  512. // You can remove this if you don't use Moment.js:
  513. new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/),
  514. // Generate a service worker script that will precache, and keep up to date,
  515. // the HTML & assets that are part of the Webpack build.
  516. new WorkboxWebpackPlugin.GenerateSW({
  517. clientsClaim: true,
  518. exclude: [/\.map$/, /asset-manifest\.json$/],
  519. importWorkboxFrom: 'cdn',
  520. navigateFallback: publicUrl + '/index.html',
  521. navigateFallbackBlacklist: [
  522. // Exclude URLs starting with /_, as they're likely an API call
  523. new RegExp('^/_'),
  524. // Exclude URLs containing a dot, as they're likely a resource in
  525. // public/ and not a SPA route
  526. new RegExp('/[^/]+\\.[^/]+$'),
  527. ],
  528. }),
  529. // TypeScript type checking
  530. fs.existsSync(paths.appTsConfig) &&
  531. new ForkTsCheckerWebpackPlugin({
  532. typescript: resolve.sync('typescript', {
  533. basedir: paths.appNodeModules,
  534. }),
  535. async: false,
  536. checkSyntacticErrors: true,
  537. tsconfig: paths.appTsConfig,
  538. compilerOptions: {
  539. module: 'esnext',
  540. moduleResolution: 'node',
  541. resolveJsonModule: true,
  542. isolatedModules: true,
  543. noEmit: true,
  544. jsx: 'preserve',
  545. },
  546. reportFiles: [
  547. '**',
  548. '!**/*.json',
  549. '!**/__tests__/**',
  550. '!**/?(*.)(spec|test).*',
  551. '!src/setupProxy.js',
  552. '!src/setupTests.*',
  553. ],
  554. watch: paths.appSrc,
  555. silent: true,
  556. formatter: typescriptFormatter,
  557. }),
  558. ].filter(Boolean),
  559. // Some libraries import Node modules but don't use them in the browser.
  560. // Tell Webpack to provide empty mocks for them so importing them works.
  561. node: {
  562. dgram: 'empty',
  563. fs: 'empty',
  564. net: 'empty',
  565. tls: 'empty',
  566. child_process: 'empty',
  567. },
  568. // Turn off performance processing because we utilize
  569. // our own hints via the FileSizeReporter
  570. performance: false,
  571. };