@panoramax/web-viewer 4.4.0-develop-3839b5a4 → 4.4.0-develop-d8b38e70

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.
Files changed (341) hide show
  1. package/{src → build}/components/core/Basic.js +22 -16
  2. package/{src → build}/components/core/CoverageMap.js +19 -14
  3. package/{src → build}/components/core/Editor.js +16 -16
  4. package/{src → build}/components/core/PhotoViewer.js +30 -29
  5. package/{src → build}/components/core/Viewer.js +21 -20
  6. package/build/components/core/index.js +10 -0
  7. package/build/components/index.js +11 -0
  8. package/build/components/index_photoviewer.js +6 -0
  9. package/{src → build}/components/layout/BottomDrawer.js +4 -4
  10. package/{src → build}/components/layout/CorneredGrid.js +1 -1
  11. package/{src → build}/components/layout/Mini.js +5 -4
  12. package/{src → build}/components/layout/Tabs.js +1 -1
  13. package/build/components/layout/index.js +9 -0
  14. package/{src → build}/components/menus/LocationPrecisionDoc.js +4 -6
  15. package/{src → build}/components/menus/MapBackground.js +4 -6
  16. package/{src → build}/components/menus/MapFilters.js +16 -21
  17. package/{src → build}/components/menus/MapLayers.js +20 -24
  18. package/{src → build}/components/menus/MapLegend.js +3 -4
  19. package/{src → build}/components/menus/MiniPictureLegend.js +3 -4
  20. package/{src → build}/components/menus/PictureLegend.js +10 -15
  21. package/{src → build}/components/menus/PictureMetadata.js +12 -19
  22. package/{src → build}/components/menus/PlayerOptions.js +5 -7
  23. package/{src → build}/components/menus/QualityScoreDoc.js +3 -4
  24. package/{src → build}/components/menus/ReportForm.js +8 -9
  25. package/{src → build}/components/menus/SemanticsDoc.js +3 -4
  26. package/{src → build}/components/menus/SemanticsDownload.js +3 -3
  27. package/{src → build}/components/menus/SemanticsFilters.js +7 -8
  28. package/{src → build}/components/menus/SemanticsList.js +11 -18
  29. package/{src → build}/components/menus/SemanticsMetadata.js +8 -11
  30. package/{src → build}/components/menus/Share.js +6 -7
  31. package/build/components/menus/index.js +22 -0
  32. package/build/components/menus/index_photoviewer.js +11 -0
  33. package/{src → build}/components/styles.js +0 -2
  34. package/{src → build}/components/ui/AnnotationsSwitch.js +6 -8
  35. package/{src → build}/components/ui/Button.js +1 -1
  36. package/{src → build}/components/ui/ButtonGroup.js +2 -1
  37. package/{src → build}/components/ui/CopyButton.js +4 -6
  38. package/{src → build}/components/ui/Grade.js +5 -5
  39. package/{src → build}/components/ui/GradeFilter.js +3 -3
  40. package/{src → build}/components/ui/IconSwitch.js +1 -1
  41. package/{src → build}/components/ui/LinkButton.js +1 -1
  42. package/{src → build}/components/ui/ListGroup.js +3 -3
  43. package/{src → build}/components/ui/ListItem.js +1 -1
  44. package/{src → build}/components/ui/Loader.js +8 -7
  45. package/{src → build}/components/ui/Map.js +38 -26
  46. package/{src → build}/components/ui/MapMore.js +7 -7
  47. package/{src → build}/components/ui/Photo.js +29 -27
  48. package/{src → build}/components/ui/Popup.js +4 -4
  49. package/{src → build}/components/ui/QualityScore.js +4 -4
  50. package/{src → build}/components/ui/SearchBar.js +6 -7
  51. package/{src → build}/components/ui/SemanticsEditor.js +14 -15
  52. package/{src → build}/components/ui/SemanticsTable.js +4 -5
  53. package/{src → build}/components/ui/Switch.js +1 -1
  54. package/{src → build}/components/ui/TogglableGroup.js +4 -4
  55. package/build/components/ui/index.js +29 -0
  56. package/build/components/ui/index_photoviewer.js +21 -0
  57. package/{src → build}/components/ui/widgets/CopyCoordinates.js +5 -5
  58. package/{src → build}/components/ui/widgets/GeoSearch.js +10 -10
  59. package/{src → build}/components/ui/widgets/Legend.js +9 -8
  60. package/{src → build}/components/ui/widgets/LevelSelect.js +9 -7
  61. package/{src → build}/components/ui/widgets/MapFiltersButton.js +5 -5
  62. package/{src → build}/components/ui/widgets/MapLayersButton.js +5 -5
  63. package/{src → build}/components/ui/widgets/OSMEditors.js +8 -8
  64. package/{src → build}/components/ui/widgets/PictureLegendActions.js +4 -4
  65. package/{src → build}/components/ui/widgets/Player.js +6 -7
  66. package/{src → build}/components/ui/widgets/SemanticsFiltersButton.js +6 -7
  67. package/{src → build}/components/ui/widgets/Zoom.js +6 -6
  68. package/build/components/ui/widgets/index.js +16 -0
  69. package/build/components/ui/widgets/index_photoviewer.js +7 -0
  70. package/build/editor.html +94 -10
  71. package/{src → build}/img/arrow_triangle.svg +0 -1
  72. package/{src → build}/img/arrow_turn.svg +0 -1
  73. package/build/index.html +111 -1
  74. package/build/index.js +6 -95
  75. package/build/index_photoviewer.js +4 -0
  76. package/build/map.html +97 -1
  77. package/build/package.json +141 -0
  78. package/build/photo.html +85 -1
  79. package/build/servers.js +3 -4
  80. package/{src → build}/utils/API.js +33 -33
  81. package/{src → build}/utils/InitParameters.js +11 -9
  82. package/{src → build}/utils/MapStyleComposer.js +39 -37
  83. package/{src → build}/utils/PhotoAdapter.js +1 -0
  84. package/{src → build}/utils/PresetsManager.js +4 -4
  85. package/{src → build}/utils/SemanticsMapProtocol.js +3 -4
  86. package/{src → build}/utils/URLHandler.js +16 -14
  87. package/{src → build}/utils/geocoder.js +5 -5
  88. package/{src → build}/utils/i18n.js +21 -20
  89. package/build/utils/index.js +17 -0
  90. package/build/utils/index_photoviewer.js +14 -0
  91. package/{src → build}/utils/indoor.js +9 -5
  92. package/{src → build}/utils/map.js +15 -11
  93. package/{src → build}/utils/picture.js +22 -17
  94. package/{src → build}/utils/semantics.js +9 -5
  95. package/{src → build}/utils/utils.js +8 -4
  96. package/{src → build}/utils/widgets.js +2 -2
  97. package/build/viewer.html +120 -35
  98. package/build/viewer_indoor.html +90 -8
  99. package/build/widgets.html +410 -1
  100. package/package.json +81 -204
  101. package/.dockerignore +0 -7
  102. package/.gitlab-ci.yml +0 -78
  103. package/CHANGELOG.md +0 -853
  104. package/CODE_OF_CONDUCT.md +0 -134
  105. package/Dockerfile +0 -14
  106. package/build/index.css +0 -36
  107. package/build/index.css.map +0 -1
  108. package/build/index.js.map +0 -1
  109. package/build/photoviewer.css +0 -36
  110. package/build/photoviewer.css.map +0 -1
  111. package/build/photoviewer.js +0 -86
  112. package/build/photoviewer.js.map +0 -1
  113. package/build/static/media/atkinson-hyperlegible-next-latin-400-normal..woff +0 -0
  114. package/build/static/media/atkinson-hyperlegible-next-latin-400-normal..woff2 +0 -0
  115. package/build/static/media/atkinson-hyperlegible-next-latin-ext-400-normal..woff +0 -0
  116. package/build/static/media/atkinson-hyperlegible-next-latin-ext-400-normal..woff2 +0 -0
  117. package/config/env.js +0 -104
  118. package/config/getHttpsConfig.js +0 -69
  119. package/config/getPackageJson.js +0 -25
  120. package/config/jest/babelTransform.js +0 -29
  121. package/config/jest/cssTransform.js +0 -14
  122. package/config/jest/fileTransform.js +0 -40
  123. package/config/jest/mocks.js +0 -230
  124. package/config/modules.js +0 -134
  125. package/config/paths.js +0 -76
  126. package/config/pnpTs.js +0 -35
  127. package/config/webpack/persistentCache/createEnvironmentHash.js +0 -9
  128. package/config/webpack.config.js +0 -825
  129. package/config/webpackDevServer.config.js +0 -131
  130. package/docs/03_URL_settings.md +0 -218
  131. package/docs/05_Compatibility.md +0 -83
  132. package/docs/09_Develop.md +0 -141
  133. package/docs/90_Releases.md +0 -27
  134. package/docs/images/class_diagram.drawio +0 -144
  135. package/docs/images/class_diagram.jpg +0 -0
  136. package/docs/images/comparative_3drender.jpg +0 -0
  137. package/docs/images/indoor_level.png +0 -0
  138. package/docs/images/screenshot.jpg +0 -0
  139. package/docs/index.md +0 -159
  140. package/docs/reference/components/core/Basic.md +0 -211
  141. package/docs/reference/components/core/CoverageMap.md +0 -220
  142. package/docs/reference/components/core/Editor.md +0 -252
  143. package/docs/reference/components/core/PhotoViewer.md +0 -320
  144. package/docs/reference/components/core/Viewer.md +0 -398
  145. package/docs/reference/components/layout/BottomDrawer.md +0 -35
  146. package/docs/reference/components/layout/CorneredGrid.md +0 -29
  147. package/docs/reference/components/layout/Mini.md +0 -45
  148. package/docs/reference/components/layout/Tabs.md +0 -46
  149. package/docs/reference/components/menus/LocationPrecisionDoc.md +0 -15
  150. package/docs/reference/components/menus/MapBackground.md +0 -32
  151. package/docs/reference/components/menus/MapFilters.md +0 -37
  152. package/docs/reference/components/menus/MapLayers.md +0 -15
  153. package/docs/reference/components/menus/MapLegend.md +0 -32
  154. package/docs/reference/components/menus/MiniPictureLegend.md +0 -15
  155. package/docs/reference/components/menus/PictureLegend.md +0 -45
  156. package/docs/reference/components/menus/PictureMetadata.md +0 -32
  157. package/docs/reference/components/menus/PlayerOptions.md +0 -15
  158. package/docs/reference/components/menus/QualityScoreDoc.md +0 -15
  159. package/docs/reference/components/menus/ReportForm.md +0 -15
  160. package/docs/reference/components/menus/SemanticsDoc.md +0 -15
  161. package/docs/reference/components/menus/SemanticsDownload.md +0 -15
  162. package/docs/reference/components/menus/SemanticsFilters.md +0 -33
  163. package/docs/reference/components/menus/SemanticsList.md +0 -97
  164. package/docs/reference/components/menus/SemanticsMetadata.md +0 -15
  165. package/docs/reference/components/menus/ShareMenu.md +0 -32
  166. package/docs/reference/components/ui/AnnotationsSwitch.md +0 -32
  167. package/docs/reference/components/ui/Button.md +0 -40
  168. package/docs/reference/components/ui/ButtonGroup.md +0 -36
  169. package/docs/reference/components/ui/CopyButton.md +0 -41
  170. package/docs/reference/components/ui/Grade.md +0 -32
  171. package/docs/reference/components/ui/GradeFilter.md +0 -42
  172. package/docs/reference/components/ui/IconSwitch.md +0 -53
  173. package/docs/reference/components/ui/LinkButton.md +0 -45
  174. package/docs/reference/components/ui/ListGroup.md +0 -22
  175. package/docs/reference/components/ui/ListItem.md +0 -39
  176. package/docs/reference/components/ui/Loader.md +0 -56
  177. package/docs/reference/components/ui/Map.md +0 -150
  178. package/docs/reference/components/ui/MapMore.md +0 -150
  179. package/docs/reference/components/ui/Photo.md +0 -495
  180. package/docs/reference/components/ui/Popup.md +0 -56
  181. package/docs/reference/components/ui/ProgressBar.md +0 -32
  182. package/docs/reference/components/ui/QualityScore.md +0 -45
  183. package/docs/reference/components/ui/SearchBar.md +0 -63
  184. package/docs/reference/components/ui/SemanticsEditor.md +0 -113
  185. package/docs/reference/components/ui/SemanticsTable.md +0 -32
  186. package/docs/reference/components/ui/Switch.md +0 -49
  187. package/docs/reference/components/ui/TogglableGroup.md +0 -39
  188. package/docs/reference/components/ui/widgets/CopyCoordinates.md +0 -32
  189. package/docs/reference/components/ui/widgets/GeoSearch.md +0 -36
  190. package/docs/reference/components/ui/widgets/Legend.md +0 -58
  191. package/docs/reference/components/ui/widgets/LevelSelect.md +0 -16
  192. package/docs/reference/components/ui/widgets/MapFiltersButton.md +0 -37
  193. package/docs/reference/components/ui/widgets/MapLayersButton.md +0 -15
  194. package/docs/reference/components/ui/widgets/OSMEditors.md +0 -15
  195. package/docs/reference/components/ui/widgets/PictureLegendActions.md +0 -32
  196. package/docs/reference/components/ui/widgets/Player.md +0 -34
  197. package/docs/reference/components/ui/widgets/SemanticsFiltersButton.md +0 -15
  198. package/docs/reference/components/ui/widgets/Zoom.md +0 -15
  199. package/docs/reference/utils/API.md +0 -389
  200. package/docs/reference/utils/InitParameters.md +0 -68
  201. package/docs/reference/utils/MapStyleComposer.md +0 -408
  202. package/docs/reference/utils/PanoraMapProtocol.md +0 -28
  203. package/docs/reference/utils/PresetsManager.md +0 -43
  204. package/docs/reference/utils/SemanticsMapProtocol.md +0 -43
  205. package/docs/reference/utils/URLHandler.md +0 -114
  206. package/docs/reference.md +0 -99
  207. package/docs/shortcuts.md +0 -11
  208. package/docs/tutorials/aerial_imagery.md +0 -21
  209. package/docs/tutorials/authentication.md +0 -10
  210. package/docs/tutorials/custom_widgets.md +0 -59
  211. package/docs/tutorials/indoor_maps.md +0 -50
  212. package/docs/tutorials/map_style.md +0 -83
  213. package/docs/tutorials/migrate_v4.md +0 -153
  214. package/docs/tutorials/migrate_v5.md +0 -103
  215. package/docs/tutorials/semantics_overlays.md +0 -74
  216. package/docs/tutorials/synced_coverage.md +0 -43
  217. package/mkdocs.yml +0 -131
  218. package/public/editor.html +0 -53
  219. package/public/index.html +0 -70
  220. package/public/map.html +0 -55
  221. package/public/photo.html +0 -43
  222. package/public/servers.js +0 -15
  223. package/public/viewer.html +0 -79
  224. package/public/viewer_indoor.html +0 -48
  225. package/public/widgets.html +0 -366
  226. package/scripts/build.js +0 -217
  227. package/scripts/doc.js +0 -79
  228. package/scripts/start.js +0 -172
  229. package/scripts/test.js +0 -52
  230. package/src/components/core/index.js +0 -12
  231. package/src/components/index.js +0 -13
  232. package/src/components/index_photoviewer.js +0 -8
  233. package/src/components/layout/index.js +0 -9
  234. package/src/components/menus/index.js +0 -22
  235. package/src/components/menus/index_photoviewer.js +0 -13
  236. package/src/components/ui/index.js +0 -29
  237. package/src/components/ui/index_photoviewer.js +0 -23
  238. package/src/components/ui/widgets/index.js +0 -16
  239. package/src/components/ui/widgets/index_photoviewer.js +0 -9
  240. package/src/index.js +0 -8
  241. package/src/index_photoviewer.js +0 -6
  242. package/src/utils/index.js +0 -17
  243. package/src/utils/index_photoviewer.js +0 -16
  244. package/tests/components/core/Basic.test.js +0 -168
  245. package/tests/components/core/BasicMock.js +0 -25
  246. package/tests/components/core/CoverageMap.test.js +0 -20
  247. package/tests/components/core/Editor.test.js +0 -20
  248. package/tests/components/core/PhotoViewer.test.js +0 -57
  249. package/tests/components/core/Viewer.test.js +0 -85
  250. package/tests/components/core/__snapshots__/PhotoViewer.test.js.snap +0 -96
  251. package/tests/components/core/__snapshots__/Viewer.test.js.snap +0 -188
  252. package/tests/components/ui/CopyButton.test.js +0 -52
  253. package/tests/components/ui/Loader.test.js +0 -55
  254. package/tests/components/ui/Map.test.js +0 -145
  255. package/tests/components/ui/Photo.test.js +0 -437
  256. package/tests/components/ui/Popup.test.js +0 -26
  257. package/tests/components/ui/QualityScore.test.js +0 -18
  258. package/tests/components/ui/SearchBar.test.js +0 -110
  259. package/tests/components/ui/__snapshots__/CopyButton.test.js.snap +0 -33
  260. package/tests/components/ui/__snapshots__/Loader.test.js.snap +0 -56
  261. package/tests/components/ui/__snapshots__/Map.test.js.snap +0 -16
  262. package/tests/components/ui/__snapshots__/Photo.test.js.snap +0 -263
  263. package/tests/components/ui/__snapshots__/Popup.test.js.snap +0 -29
  264. package/tests/components/ui/__snapshots__/QualityScore.test.js.snap +0 -11
  265. package/tests/components/ui/__snapshots__/SearchBar.test.js.snap +0 -65
  266. package/tests/data/Map_geocoder_ban.json +0 -36
  267. package/tests/data/Map_geocoder_nominatim.json +0 -41
  268. package/tests/data/Viewer_pictures_1.json +0 -148
  269. package/tests/setupTests.js +0 -5
  270. package/tests/utils/API.test.js +0 -752
  271. package/tests/utils/InitParameters.test.js +0 -599
  272. package/tests/utils/MapStyleComposer.test.js +0 -697
  273. package/tests/utils/PresetsManager.test.js +0 -123
  274. package/tests/utils/URLHandler.test.js +0 -587
  275. package/tests/utils/__snapshots__/API.test.js.snap +0 -40
  276. package/tests/utils/__snapshots__/MapStyleComposer.test.js.snap +0 -767
  277. package/tests/utils/__snapshots__/URLHandler.test.js.snap +0 -21
  278. package/tests/utils/__snapshots__/geocoder.test.js.snap +0 -37
  279. package/tests/utils/__snapshots__/map.test.js.snap +0 -1249
  280. package/tests/utils/__snapshots__/picture.test.js.snap +0 -327
  281. package/tests/utils/__snapshots__/widgets.test.js.snap +0 -19
  282. package/tests/utils/geocoder.test.js +0 -37
  283. package/tests/utils/i18n.test.js +0 -111
  284. package/tests/utils/map.test.js +0 -200
  285. package/tests/utils/picture.test.js +0 -745
  286. package/tests/utils/semantics.test.js +0 -174
  287. package/tests/utils/utils.test.js +0 -358
  288. package/tests/utils/widgets.test.js +0 -31
  289. /package/{src → build}/components/core/Basic.css +0 -0
  290. /package/{src → build}/components/core/CoverageMap.css +0 -0
  291. /package/{src → build}/components/core/Editor.css +0 -0
  292. /package/{src → build}/components/core/PhotoViewer.css +0 -0
  293. /package/{src → build}/components/core/Viewer.css +0 -0
  294. /package/{src → build}/components/ui/ButtonGroup.css +0 -0
  295. /package/{src → build}/components/ui/Map.css +0 -0
  296. /package/{src → build}/components/ui/Photo.css +0 -0
  297. /package/{src → build}/components/ui/ProgressBar.js +0 -0
  298. /package/{src → build}/components/ui/widgets/GeoSearch.css +0 -0
  299. /package/{src → build}/components/ui/widgets/LevelSelect.css +0 -0
  300. /package/{src → build}/components/ui/widgets/Player.css +0 -0
  301. /package/{public → build}/favicon.ico +0 -0
  302. /package/{src → build}/img/arrow_360.svg +0 -0
  303. /package/{src → build}/img/arrow_flat.svg +0 -0
  304. /package/{src → build}/img/bg_aerial.jpg +0 -0
  305. /package/{src → build}/img/bg_streets.jpg +0 -0
  306. /package/{src → build}/img/loader_base.jpg +0 -0
  307. /package/{src → build}/img/logo_dead.svg +0 -0
  308. /package/{src → build}/img/marker.svg +0 -0
  309. /package/{src → build}/img/marker_blue.svg +0 -0
  310. /package/{src → build}/img/osm.svg +0 -0
  311. /package/{src → build}/img/panoramax.svg +0 -0
  312. /package/{src → build}/img/switch_big.svg +0 -0
  313. /package/{src → build}/img/switch_mini.svg +0 -0
  314. /package/{src → build}/img/wd.svg +0 -0
  315. /package/{src → build}/translations/ar.json +0 -0
  316. /package/{src → build}/translations/be.json +0 -0
  317. /package/{src → build}/translations/br.json +0 -0
  318. /package/{src → build}/translations/cy.json +0 -0
  319. /package/{src → build}/translations/da.json +0 -0
  320. /package/{src → build}/translations/de.json +0 -0
  321. /package/{src → build}/translations/en.json +0 -0
  322. /package/{src → build}/translations/eo.json +0 -0
  323. /package/{src → build}/translations/es.json +0 -0
  324. /package/{src → build}/translations/fi.json +0 -0
  325. /package/{src → build}/translations/fr.json +0 -0
  326. /package/{src → build}/translations/hu.json +0 -0
  327. /package/{src → build}/translations/it.json +0 -0
  328. /package/{src → build}/translations/ja.json +0 -0
  329. /package/{src → build}/translations/ko.json +0 -0
  330. /package/{src → build}/translations/nl.json +0 -0
  331. /package/{src → build}/translations/nn.json +0 -0
  332. /package/{src → build}/translations/pl.json +0 -0
  333. /package/{src → build}/translations/pt.json +0 -0
  334. /package/{src → build}/translations/pt_BR.json +0 -0
  335. /package/{src → build}/translations/sv.json +0 -0
  336. /package/{src → build}/translations/ti.json +0 -0
  337. /package/{src → build}/translations/tr.json +0 -0
  338. /package/{src → build}/translations/uk.json +0 -0
  339. /package/{src → build}/translations/zh_Hant.json +0 -0
  340. /package/{src → build}/utils/PanoraMapProtocol.js +0 -0
  341. /package/{src → build}/utils/services.js +0 -0
@@ -1,825 +0,0 @@
1
- /* eslint-disable */
2
- const fs = require('fs');
3
- const path = require('path');
4
- const webpack = require('webpack');
5
- const resolve = require('resolve');
6
- const HtmlWebpackPlugin = require('html-webpack-plugin');
7
- const CaseSensitivePathsPlugin = require('case-sensitive-paths-webpack-plugin');
8
- const InlineChunkHtmlPlugin = require('react-dev-utils/InlineChunkHtmlPlugin');
9
- const TerserPlugin = require('terser-webpack-plugin');
10
- const MiniCssExtractPlugin = require('mini-css-extract-plugin');
11
- const CssMinimizerPlugin = require('css-minimizer-webpack-plugin');
12
- const { WebpackManifestPlugin } = require('webpack-manifest-plugin');
13
- const InterpolateHtmlPlugin = require('react-dev-utils/InterpolateHtmlPlugin');
14
- const WorkboxWebpackPlugin = require('workbox-webpack-plugin');
15
- const ModuleScopePlugin = require('react-dev-utils/ModuleScopePlugin');
16
- const getCSSModuleLocalIdent = require('react-dev-utils/getCSSModuleLocalIdent');
17
- const CopyPlugin = require("copy-webpack-plugin");
18
- const ESLintPlugin = require('eslint-webpack-plugin');
19
- const paths = require('./paths');
20
- const modules = require('./modules');
21
- const getClientEnvironment = require('./env');
22
- const ModuleNotFoundPlugin = require('react-dev-utils/ModuleNotFoundPlugin');
23
- //const WebpackBundleAnalyzer = require('webpack-bundle-analyzer');
24
- const ForkTsCheckerWebpackPlugin =
25
- process.env.TSC_COMPILE_ON_ERROR === 'true'
26
- ? require('react-dev-utils/ForkTsCheckerWarningWebpackPlugin')
27
- : require('react-dev-utils/ForkTsCheckerWebpackPlugin');
28
- const ReactRefreshWebpackPlugin = require('@pmmmwh/react-refresh-webpack-plugin');
29
- const getPackageJson = require('./getPackageJson');
30
-
31
- const createEnvironmentHash = require('./webpack/persistentCache/createEnvironmentHash');
32
- const appPackageJson = require(paths.appPackageJson);
33
-
34
- // Source maps are resource heavy and can cause out of memory issue for large source files.
35
- const shouldUseSourceMap = process.env.GENERATE_SOURCEMAP !== 'false';
36
-
37
- const reactRefreshRuntimeEntry = require.resolve('react-refresh/runtime');
38
- const reactRefreshWebpackPluginRuntimeEntry = require.resolve(
39
- '@pmmmwh/react-refresh-webpack-plugin'
40
- );
41
- const babelRuntimeEntry = require.resolve('babel-preset-react-app');
42
- const babelRuntimeEntryHelpers = require.resolve(
43
- '@babel/runtime/helpers/esm/assertThisInitialized',
44
- { paths: [babelRuntimeEntry] }
45
- );
46
- const babelRuntimeRegenerator = require.resolve('@babel/runtime/regenerator', {
47
- paths: [babelRuntimeEntry],
48
- });
49
-
50
- // Some apps do not need the benefits of saving a web request, so not inlining the chunk
51
- // makes for a smoother build process.
52
- const shouldInlineRuntimeChunk = process.env.INLINE_RUNTIME_CHUNK !== 'false';
53
-
54
- const emitErrorsAsWarnings = process.env.ESLINT_NO_DEV_ERRORS === 'true';
55
- const disableESLintPlugin = process.env.DISABLE_ESLINT_PLUGIN === 'true';
56
-
57
- const imageInlineSizeLimit = parseInt(
58
- process.env.IMAGE_INLINE_SIZE_LIMIT || '10000'
59
- );
60
-
61
- // Check if TypeScript is setup
62
- const useTypeScript = fs.existsSync(paths.appTsConfig);
63
-
64
- // Check if Tailwind config exists
65
- const useTailwind = fs.existsSync(
66
- path.join(paths.appPath, 'tailwind.config.js')
67
- );
68
-
69
- // Get the path to the uncompiled service worker (if it exists).
70
- const swSrc = paths.swSrc;
71
-
72
- // style files regexes
73
- const cssRegex = /\.css$/;
74
- const cssModuleRegex = /\.module\.css$/;
75
- const sassRegex = /\.(scss|sass)$/;
76
- const sassModuleRegex = /\.module\.(scss|sass)$/;
77
-
78
- const {
79
- version,
80
- name,
81
- license,
82
- repository,
83
- author,
84
- } = getPackageJson('version', 'name', 'license', 'repository', 'author');
85
-
86
- // get git info from command line
87
- const commitHash = require('child_process')
88
- .execSync('git rev-parse --short HEAD')
89
- .toString()
90
- .trim();
91
-
92
- const banner = `
93
- ${name} v${version}
94
- ${repository.url}
95
-
96
- Copyright (c) ${author.replace(/ *<[^)]*> */g, " ")}
97
-
98
- This source code is licensed under the ${license} license found in the
99
- LICENSE file in the root directory of this source tree.
100
- `;
101
-
102
- const hasJsxRuntime = (() => {
103
- if (process.env.DISABLE_NEW_JSX_TRANSFORM === 'true') {
104
- return false;
105
- }
106
-
107
- try {
108
- require.resolve('react/jsx-runtime');
109
- return true;
110
- } catch (e) {
111
- return false;
112
- }
113
- })();
114
-
115
- // This is the production and development configuration.
116
- // It is focused on developer experience, fast rebuilds, and a minimal bundle.
117
- module.exports = function (webpackEnv) {
118
- const isEnvDevelopment = webpackEnv === 'development';
119
- const isEnvProduction = webpackEnv === 'production';
120
-
121
- // Variable used for enabling profiling in Production
122
- // passed into alias object. Uses a flag if passed into the build command
123
- const isEnvProductionProfile =
124
- isEnvProduction && process.argv.includes('--profile');
125
-
126
- // We will provide `paths.publicUrlOrPath` to our app
127
- // as %PUBLIC_URL% in `index.html` and `process.env.PUBLIC_URL` in JavaScript.
128
- // Omit trailing slash as %PUBLIC_URL%/xyz looks better than %PUBLIC_URL%xyz.
129
- // Get environment variables to inject into our app.
130
- const env = getClientEnvironment(paths.publicUrlOrPath.slice(0, -1));
131
-
132
- const shouldUseReactRefresh = env.raw.FAST_REFRESH;
133
-
134
- // common function to get style loaders
135
- const getStyleLoaders = (cssOptions, preProcessor) => {
136
- const loaders = [
137
- isEnvDevelopment && require.resolve('style-loader'),
138
- isEnvProduction && {
139
- loader: MiniCssExtractPlugin.loader,
140
- // css is located in `static/css`, use '../../' to locate index.html folder
141
- // in production `paths.publicUrlOrPath` can be a relative path
142
- options: paths.publicUrlOrPath.startsWith('.')
143
- ? { publicPath: '../../' }
144
- : {},
145
- },
146
- {
147
- loader: require.resolve('css-loader'),
148
- options: cssOptions,
149
- },
150
- {
151
- // Options for PostCSS as we reference these options twice
152
- // Adds vendor prefixing based on your specified browser support in
153
- // package.json
154
- loader: require.resolve('postcss-loader'),
155
- options: {
156
- postcssOptions: {
157
- // Necessary for external CSS imports to work
158
- // https://github.com/facebook/create-react-app/issues/2677
159
- ident: 'postcss',
160
- config: false,
161
- plugins: !useTailwind
162
- ? [
163
- 'postcss-flexbugs-fixes',
164
- [
165
- 'postcss-preset-env',
166
- {
167
- autoprefixer: {
168
- flexbox: 'no-2009',
169
- },
170
- stage: 3,
171
- },
172
- ],
173
- // Adds PostCSS Normalize as the reset css with default options,
174
- // so that it honors browserslist config in package.json
175
- // which in turn let's users customize the target behavior as per their needs.
176
- 'postcss-normalize',
177
- ]
178
- : [
179
- 'tailwindcss',
180
- 'postcss-flexbugs-fixes',
181
- [
182
- 'postcss-preset-env',
183
- {
184
- autoprefixer: {
185
- flexbox: 'no-2009',
186
- },
187
- stage: 3,
188
- },
189
- ],
190
- ],
191
- },
192
- sourceMap: isEnvProduction ? shouldUseSourceMap : isEnvDevelopment,
193
- },
194
- },
195
- ].filter(Boolean);
196
- if (preProcessor) {
197
- loaders.push(
198
- {
199
- loader: require.resolve('resolve-url-loader'),
200
- options: {
201
- sourceMap: isEnvProduction ? shouldUseSourceMap : isEnvDevelopment,
202
- root: paths.appSrc,
203
- },
204
- },
205
- {
206
- loader: require.resolve(preProcessor),
207
- options: {
208
- sourceMap: true,
209
- },
210
- }
211
- );
212
- }
213
- return loaders;
214
- };
215
-
216
- const getHtmlPlugin = (filename, template) => new HtmlWebpackPlugin(
217
- Object.assign(
218
- {},
219
- {
220
- inject: true,
221
- filename: filename,
222
- template: template,
223
- chunks: ["index"],
224
- },
225
- isEnvProduction
226
- ? {
227
- minify: {
228
- removeComments: true,
229
- collapseWhitespace: true,
230
- removeRedundantAttributes: true,
231
- useShortDoctype: true,
232
- removeEmptyAttributes: true,
233
- removeStyleLinkTypeAttributes: true,
234
- keepClosingSlash: true,
235
- minifyJS: true,
236
- minifyCSS: true,
237
- minifyURLs: true,
238
- },
239
- }
240
- : undefined
241
- )
242
- );
243
-
244
- return {
245
- target: ['browserslist'],
246
- mode: isEnvProduction ? 'production' : isEnvDevelopment && 'development',
247
- // Stop compilation early in production
248
- bail: isEnvProduction,
249
- devtool: isEnvProduction
250
- ? shouldUseSourceMap
251
- ? 'source-map'
252
- : false
253
- : isEnvDevelopment && 'cheap-module-source-map',
254
- // These are the "entry points" to our application.
255
- // This means they will be the "root" imports that are included in JS bundle.
256
- entry: Object.assign(
257
- { index: paths.appLibIndexJs },
258
- isEnvProduction ? { photoviewer: paths.appLibPhotoViewerJs } : {},
259
- ),
260
- output: {
261
- globalObject: 'this',
262
- // The build folder.
263
- path: paths.appBuild,
264
- // Add /* filename */ comments to generated require()s in the output.
265
- pathinfo: isEnvDevelopment,
266
- // There will be one main bundle, and one file per asynchronous chunk.
267
- // In development, it does not produce real files.
268
- filename: isEnvProduction
269
- ? '[name].js'
270
- : isEnvDevelopment && 'static/js/bundle.js',
271
- // There are also additional JS chunk files if you use code splitting.
272
- chunkFilename: isEnvProduction
273
- ? 'static/js/[name].[contenthash:8].chunk.js'
274
- : isEnvDevelopment && 'static/js/[name].chunk.js',
275
- assetModuleFilename: 'static/media/[name].[ext]',
276
- // webpack uses `publicPath` to determine where the app is being served from.
277
- // It requires a trailing slash, or the file assets will get an incorrect path.
278
- // We inferred the "public path" (such as / or /my-project) from homepage.
279
- publicPath: paths.publicUrlOrPath,
280
- library: "Panoramax",
281
- libraryTarget: 'umd',
282
- umdNamedDefine: true,
283
- // Point sourcemap entries to original disk location (format as URL on Windows)
284
- devtoolModuleFilenameTemplate: isEnvProduction
285
- ? info =>
286
- path
287
- .relative(paths.appSrcLib, info.absoluteResourcePath)
288
- .replace(/\\/g, '/')
289
- : isEnvDevelopment &&
290
- (info => path.resolve(info.absoluteResourcePath).replace(/\\/g, '/')),
291
- },
292
- cache: {
293
- type: 'filesystem',
294
- version: createEnvironmentHash(env.raw),
295
- cacheDirectory: paths.appWebpackCache,
296
- store: 'pack',
297
- buildDependencies: {
298
- defaultWebpack: ['webpack/lib/'],
299
- config: [__filename],
300
- tsconfig: [paths.appTsConfig, paths.appJsConfig].filter(f =>
301
- fs.existsSync(f)
302
- ),
303
- },
304
- },
305
- infrastructureLogging: {
306
- level: 'none',
307
- },
308
- optimization: {
309
- minimize: isEnvProduction,
310
- concatenateModules: false, // /!\ DO NOT REMOVE : keeps constructor name after compiling
311
- minimizer: [
312
- // This is only used in production mode
313
- new TerserPlugin({
314
- extractComments: false,
315
- terserOptions: {
316
- parse: {
317
- // We want terser to parse ecma 8 code. However, we don't want it
318
- // to apply any minification steps that turns valid ecma 5 code
319
- // into invalid ecma 5 code. This is why the 'compress' and 'output'
320
- // sections only apply transformations that are ecma 5 safe
321
- // https://github.com/facebook/create-react-app/pull/4234
322
- ecma: 8,
323
- },
324
- compress: {
325
- ecma: 5,
326
- warnings: false,
327
- // Disabled because of an issue with Uglify breaking seemingly valid code:
328
- // https://github.com/facebook/create-react-app/issues/2376
329
- // Pending further investigation:
330
- // https://github.com/mishoo/UglifyJS2/issues/2011
331
- comparisons: false,
332
- // Disabled because of an issue with Terser breaking valid code:
333
- // https://github.com/facebook/create-react-app/issues/5250
334
- // Pending further investigation:
335
- // https://github.com/terser-js/terser/issues/120
336
- inline: 2,
337
- },
338
- mangle: {
339
- safari10: true,
340
- keep_classnames: true,
341
- keep_fnames: true,
342
- module: true,
343
- },
344
- // Added for profiling in devtools
345
- keep_classnames: isEnvProductionProfile,
346
- keep_fnames: isEnvProductionProfile,
347
- output: {
348
- ecma: 5,
349
- // Turned on because emoji and regex is not minified properly using default
350
- // https://github.com/facebook/create-react-app/issues/2488
351
- ascii_only: true,
352
- },
353
- },
354
- }),
355
- // This is only used in production mode
356
- new webpack.BannerPlugin({
357
- banner: banner,
358
- entryOnly: true
359
- }),
360
- new CssMinimizerPlugin(),
361
- ],
362
- },
363
- resolve: {
364
- // This allows you to set a fallback for where webpack should look for modules.
365
- // We placed these paths second because we want `node_modules` to "win"
366
- // if there are any conflicts. This matches Node resolution mechanism.
367
- // https://github.com/facebook/create-react-app/issues/253
368
- modules: ['node_modules', paths.appNodeModules].concat(
369
- modules.additionalModulePaths || []
370
- ),
371
- // These are the reasonable defaults supported by the Node ecosystem.
372
- // We also include JSX as a common component filename extension to support
373
- // some tools, although we do not recommend using it, see:
374
- // https://github.com/facebook/create-react-app/issues/290
375
- // `web` extension prefixes have been added for better support
376
- // for React Native Web.
377
- extensions: paths.moduleFileExtensions
378
- .map(ext => `.${ext}`)
379
- .filter(ext => useTypeScript || !ext.includes('ts')),
380
- alias: {
381
- // Support React Native Web
382
- // https://www.smashingmagazine.com/2016/08/a-glimpse-into-the-future-with-react-native-for-web/
383
- 'react-native': 'react-native-web',
384
- // Allows for better profiling with ReactDevTools
385
- ...(isEnvProductionProfile && {
386
- 'react-dom$': 'react-dom/profiling',
387
- 'scheduler/tracing': 'scheduler/tracing-profiling',
388
- }),
389
- ...(modules.webpackAliases || {}),
390
- },
391
- plugins: [
392
- // Prevents users from importing files from outside of src/ (or node_modules/).
393
- // This often causes confusion because we only process files within src/ with babel.
394
- // To fix this, we prevent you from importing files out of src/ -- if you'd like to,
395
- // please link the files into your node_modules/ and let module-resolution kick in.
396
- // Make sure your source files are compiled, as they will not be processed in any way.
397
- new ModuleScopePlugin(paths.appSrc, [
398
- paths.appPackageJson,
399
- reactRefreshRuntimeEntry,
400
- reactRefreshWebpackPluginRuntimeEntry,
401
- babelRuntimeEntry,
402
- babelRuntimeEntryHelpers,
403
- babelRuntimeRegenerator,
404
- ]),
405
- ],
406
- },
407
- module: {
408
- strictExportPresence: true,
409
- rules: [
410
- // Handle node_modules packages that contain sourcemaps
411
- shouldUseSourceMap && {
412
- enforce: 'pre',
413
- exclude: /@babel(?:\/|\\{1,2})runtime/,
414
- test: /\.(js|mjs|jsx|ts|tsx|css)$/,
415
- loader: require.resolve('source-map-loader'),
416
- },
417
- {
418
- // "oneOf" will traverse all following loaders until one will
419
- // match the requirements. When no loader matches it will fall
420
- // back to the "file" loader at the end of the loader list.
421
- oneOf: [
422
- // TODO: Merge this config once `image/avif` is in the mime-db
423
- // https://github.com/jshttp/mime-db
424
- {
425
- test: [/\.avif$/],
426
- type: 'asset',
427
- mimetype: 'image/avif',
428
- parser: {
429
- dataUrlCondition: {
430
- maxSize: imageInlineSizeLimit,
431
- },
432
- },
433
- },
434
- // "url" loader works like "file" loader except that it embeds assets
435
- // smaller than specified limit in bytes as data URLs to avoid requests.
436
- // A missing `test` is equivalent to a match.
437
- {
438
- test: [/\.bmp$/, /\.gif$/, /\.jpe?g$/, /\.png$/],
439
- type: 'asset/inline',
440
- parser: {
441
- dataUrlCondition: {
442
- //~ maxSize: imageInlineSizeLimit,
443
- },
444
- },
445
- },
446
- {
447
- test: /\.svg$/,
448
- type: 'asset/inline',
449
- //~ use: [
450
- //~ {
451
- //~ loader: require.resolve('@svgr/webpack'),
452
- //~ options: {
453
- //~ prettier: false,
454
- //~ svgo: false,
455
- //~ svgoConfig: {
456
- //~ plugins: [{ removeViewBox: false }],
457
- //~ },
458
- //~ titleProp: true,
459
- //~ ref: true,
460
- //~ },
461
- //~ },
462
- //~ {
463
- //~ loader: require.resolve('file-loader'),
464
- //~ options: {
465
- //~ name: 'static/media/[name].[hash].[ext]',
466
- //~ },
467
- //~ },
468
- //~ ],
469
- //~ issuer: {
470
- //~ and: [/\.(ts|tsx|js|jsx|md|mdx)$/],
471
- //~ },
472
- },
473
- // Process application JS with Babel.
474
- // The preset includes JSX, Flow, TypeScript, and some ESnext features.
475
- {
476
- test: /\.(js|mjs|jsx|ts|tsx)$/,
477
- include: paths.appSrcLib,
478
- loader: require.resolve('babel-loader'),
479
- options: {
480
- customize: require.resolve(
481
- 'babel-preset-react-app/webpack-overrides'
482
- ),
483
- presets: [
484
- [
485
- require.resolve('babel-preset-react-app'),
486
- {
487
- runtime: hasJsxRuntime ? 'automatic' : 'classic',
488
- },
489
- ],
490
- ],
491
-
492
- plugins: [
493
- isEnvDevelopment &&
494
- shouldUseReactRefresh &&
495
- require.resolve('react-refresh/babel'),
496
- ].filter(Boolean),
497
- // This is a feature of `babel-loader` for webpack (not Babel itself).
498
- // It enables caching results in ./node_modules/.cache/babel-loader/
499
- // directory for faster rebuilds.
500
- cacheDirectory: true,
501
- // See #6846 for context on why cacheCompression is disabled
502
- cacheCompression: false,
503
- compact: isEnvProduction,
504
- },
505
- },
506
- // Process any JS outside of the app with Babel.
507
- // Unlike the application JS, we only compile the standard ES features.
508
- {
509
- test: /\.(js|mjs)$/,
510
- exclude: /@babel(?:\/|\\{1,2})runtime/,
511
- loader: require.resolve('babel-loader'),
512
- options: {
513
- babelrc: false,
514
- configFile: false,
515
- compact: false,
516
- presets: [
517
- [
518
- require.resolve('babel-preset-react-app/dependencies'),
519
- { helpers: true },
520
- ],
521
- ['@babel/preset-env', { loose: true }],
522
- "@babel/preset-react"
523
- ],
524
- plugins: [
525
- ["@babel/plugin-proposal-class-properties", { "loose": true }],
526
- ["@babel/plugin-proposal-private-property-in-object", { "loose": true }]
527
- ],
528
- cacheDirectory: true,
529
- // See #6846 for context on why cacheCompression is disabled
530
- cacheCompression: false,
531
-
532
- // Babel sourcemaps are needed for debugging into node_modules
533
- // code. Without the options below, debuggers like VSCode
534
- // show incorrect code and set breakpoints on the wrong lines.
535
- sourceMaps: shouldUseSourceMap,
536
- inputSourceMap: shouldUseSourceMap,
537
- },
538
- },
539
- // "postcss" loader applies autoprefixer to our CSS.
540
- // "css" loader resolves paths in CSS and adds assets as dependencies.
541
- // "style" loader turns CSS into JS modules that inject <style> tags.
542
- // In production, we use MiniCSSExtractPlugin to extract that CSS
543
- // to a file, but in development "style" loader enables hot editing
544
- // of CSS.
545
- // By default we support CSS Modules with the extension .module.css
546
- {
547
- test: cssRegex,
548
- exclude: cssModuleRegex,
549
- use: getStyleLoaders({
550
- importLoaders: 1,
551
- sourceMap: isEnvProduction
552
- ? shouldUseSourceMap
553
- : isEnvDevelopment,
554
- modules: {
555
- mode: 'icss',
556
- },
557
- }),
558
- // Don't consider CSS imports dead code even if the
559
- // containing package claims to have no side effects.
560
- // Remove this when webpack adds a warning or an error for this.
561
- // See https://github.com/webpack/webpack/issues/6571
562
- sideEffects: true,
563
- },
564
- // Adds support for CSS Modules (https://github.com/css-modules/css-modules)
565
- // using the extension .module.css
566
- {
567
- test: cssModuleRegex,
568
- use: getStyleLoaders({
569
- importLoaders: 1,
570
- sourceMap: isEnvProduction
571
- ? shouldUseSourceMap
572
- : isEnvDevelopment,
573
- modules: {
574
- mode: 'local',
575
- getLocalIdent: getCSSModuleLocalIdent,
576
- },
577
- }),
578
- },
579
- // Opt-in support for SASS (using .scss or .sass extensions).
580
- // By default we support SASS Modules with the
581
- // extensions .module.scss or .module.sass
582
- {
583
- test: sassRegex,
584
- exclude: sassModuleRegex,
585
- use: getStyleLoaders(
586
- {
587
- importLoaders: 3,
588
- sourceMap: isEnvProduction
589
- ? shouldUseSourceMap
590
- : isEnvDevelopment,
591
- modules: {
592
- mode: 'icss',
593
- },
594
- },
595
- 'sass-loader'
596
- ),
597
- // Don't consider CSS imports dead code even if the
598
- // containing package claims to have no side effects.
599
- // Remove this when webpack adds a warning or an error for this.
600
- // See https://github.com/webpack/webpack/issues/6571
601
- sideEffects: true,
602
- },
603
- // Adds support for CSS Modules, but using SASS
604
- // using the extension .module.scss or .module.sass
605
- {
606
- test: sassModuleRegex,
607
- use: getStyleLoaders(
608
- {
609
- importLoaders: 3,
610
- sourceMap: isEnvProduction
611
- ? shouldUseSourceMap
612
- : isEnvDevelopment,
613
- modules: {
614
- mode: 'local',
615
- getLocalIdent: getCSSModuleLocalIdent,
616
- },
617
- },
618
- 'sass-loader'
619
- ),
620
- },
621
- // "file" loader makes sure those assets get served by WebpackDevServer.
622
- // When you `import` an asset, you get its (virtual) filename.
623
- // In production, they would get copied to the `build` folder.
624
- // This loader doesn't use a "test" so it will catch all modules
625
- // that fall through the other loaders.
626
- {
627
- // Exclude `js` files to keep "css" loader working as it injects
628
- // its runtime that would otherwise be processed through "file" loader.
629
- // Also exclude `html` and `json` extensions so they get processed
630
- // by webpacks internal loaders.
631
- exclude: [/^$/, /\.(js|mjs|jsx|ts|tsx)$/, /\.html$/, /\.json$/],
632
- type: 'asset/resource',
633
- },
634
- // ** STOP ** Are you adding a new loader?
635
- // Make sure to add the new loader(s) before the "file" loader.
636
- ],
637
- },
638
- ].filter(Boolean),
639
- },
640
- plugins: [
641
- new webpack.DefinePlugin({
642
- __COMMIT_HASH__: JSON.stringify(commitHash)
643
- }),
644
-
645
- // HTML demo pages
646
- getHtmlPlugin("index.html", paths.appHtml),
647
- getHtmlPlugin("map.html", paths.appHtmlMap),
648
- getHtmlPlugin("editor.html", paths.appHtmlEditor),
649
- getHtmlPlugin("viewer.html", paths.appHtmlViewer),
650
- getHtmlPlugin("viewer_indoor.html", paths.appHtmlViewerIndoor),
651
- getHtmlPlugin("photo.html", paths.appHtmlPhotoViewer),
652
- getHtmlPlugin("widgets.html", paths.appHtmlWidgets),
653
-
654
- new CopyPlugin({
655
- patterns: [{
656
- from: "public/servers.js",
657
- info: { minimized: true },
658
- }],
659
- }),
660
-
661
- // Inlines the webpack runtime script. This script is too small to warrant
662
- // a network request.
663
- // https://github.com/facebook/create-react-app/issues/5358
664
- isEnvProduction &&
665
- shouldInlineRuntimeChunk &&
666
- new InlineChunkHtmlPlugin(HtmlWebpackPlugin, [/runtime-.+[.]js/]),
667
- // Makes some environment variables available in index.html.
668
- // The public URL is available as %PUBLIC_URL% in index.html, e.g.:
669
- // <link rel="icon" href="%PUBLIC_URL%/favicon.ico">
670
- // It will be an empty string unless you specify "homepage"
671
- // in `package.json`, in which case it will be the pathname of that URL.
672
- new InterpolateHtmlPlugin(HtmlWebpackPlugin, env.raw),
673
- // This gives some necessary context to module not found errors, such as
674
- // the requesting resource.
675
- new ModuleNotFoundPlugin(paths.appPath),
676
- //isEnvProduction && new WebpackBundleAnalyzer.BundleAnalyzerPlugin(),
677
- // Makes some environment variables available to the JS code, for example:
678
- // if (process.env.NODE_ENV === 'production') { ... }. See `./env.js`.
679
- // It is absolutely essential that NODE_ENV is set to production
680
- // during a production build.
681
- // Otherwise React will be compiled in the very slow development mode.
682
- new webpack.DefinePlugin(env.stringified),
683
- // Experimental hot reloading for React .
684
- // https://github.com/facebook/react/tree/main/packages/react-refresh
685
- isEnvDevelopment &&
686
- shouldUseReactRefresh &&
687
- new ReactRefreshWebpackPlugin({
688
- overlay: false,
689
- }),
690
- // Watcher doesn't work well if you mistype casing in a path so we use
691
- // a plugin that prints an error when you attempt to do this.
692
- // See https://github.com/facebook/create-react-app/issues/240
693
- isEnvDevelopment && new CaseSensitivePathsPlugin(),
694
- isEnvProduction &&
695
- new MiniCssExtractPlugin({
696
- // Options similar to the same options in webpackOptions.output
697
- // both options are optional
698
- filename: '[name].css',
699
- chunkFilename: 'index.[contenthash:8].chunk.css',
700
- }),
701
- // Generate an asset manifest file with the following content:
702
- // - "files" key: Mapping of all asset filenames to their corresponding
703
- // output file so that tools can pick it up without having to parse
704
- // `index.html`
705
- // - "entrypoints" key: Array of files which are included in `index.html`,
706
- // can be used to reconstruct the HTML if necessary
707
- /*new WebpackManifestPlugin({
708
- fileName: 'asset-manifest.json',
709
- publicPath: paths.publicUrlOrPath,
710
- generate: (seed, files, entrypoints) => {
711
- const manifestFiles = files.reduce((manifest, file) => {
712
- manifest[file.name] = file.path;
713
- return manifest;
714
- }, seed);
715
- const entrypointFiles = entrypoints.main.filter(
716
- fileName => !fileName.endsWith('.map')
717
- );
718
-
719
- return {
720
- files: manifestFiles,
721
- entrypoints: entrypointFiles,
722
- };
723
- },
724
- }),*/
725
- // Moment.js is an extremely popular library that bundles large locale files
726
- // by default due to how webpack interprets its code. This is a practical
727
- // solution that requires the user to opt into importing specific locales.
728
- // https://github.com/jmblog/how-to-optimize-momentjs-with-webpack
729
- // You can remove this if you don't use Moment.js:
730
- new webpack.IgnorePlugin({
731
- resourceRegExp: /^\.\/locale$/,
732
- contextRegExp: /moment$/,
733
- }),
734
- // Generate a service worker script that will precache, and keep up to date,
735
- // the HTML & assets that are part of the webpack build.
736
- /*isEnvProduction &&
737
- fs.existsSync(swSrc) &&
738
- new WorkboxWebpackPlugin.InjectManifest({
739
- swSrc,
740
- dontCacheBustURLsMatching: /\.[0-9a-f]{8}\./,
741
- exclude: [/\.map$/, /asset-manifest\.json$/, /LICENSE/],
742
- // Bump up the default maximum size (2mb) that's precached,
743
- // to make lazy-loading failure scenarios less likely.
744
- // See https://github.com/cra-template/pwa/issues/13#issuecomment-722667270
745
- maximumFileSizeToCacheInBytes: 5 * 1024 * 1024,
746
- }),*/
747
- // TypeScript type checking
748
- useTypeScript &&
749
- new ForkTsCheckerWebpackPlugin({
750
- async: isEnvDevelopment,
751
- typescript: {
752
- typescriptPath: resolve.sync('typescript', {
753
- basedir: paths.appNodeModules,
754
- }),
755
- configOverwrite: {
756
- compilerOptions: {
757
- sourceMap: isEnvProduction
758
- ? shouldUseSourceMap
759
- : isEnvDevelopment,
760
- skipLibCheck: true,
761
- inlineSourceMap: false,
762
- declarationMap: false,
763
- noEmit: true,
764
- incremental: true,
765
- tsBuildInfoFile: paths.appTsBuildInfoFile,
766
- },
767
- },
768
- context: paths.appPath,
769
- diagnosticOptions: {
770
- syntactic: true,
771
- },
772
- mode: 'write-references',
773
- // profile: true,
774
- },
775
- issue: {
776
- // This one is specifically to match during CI tests,
777
- // as micromatch doesn't match
778
- // '../cra-template-typescript/template/src/App.tsx'
779
- // otherwise.
780
- include: [
781
- { file: '../**/src/**/*.{ts,tsx}' },
782
- { file: '**/src/**/*.{ts,tsx}' },
783
- ],
784
- exclude: [
785
- { file: '**/src/**/__tests__/**' },
786
- { file: '**/src/**/?(*.){spec|test}.*' },
787
- { file: '**/src/setupProxy.*' },
788
- { file: '**/tests/setupTests.*' },
789
- ],
790
- },
791
- logger: {
792
- infrastructure: 'silent',
793
- },
794
- }),
795
- !disableESLintPlugin &&
796
- new ESLintPlugin({
797
- // Plugin options
798
- extensions: ['js', 'mjs', 'jsx', 'ts', 'tsx'],
799
- formatter: require.resolve('react-dev-utils/eslintFormatter'),
800
- eslintPath: require.resolve('eslint'),
801
- failOnError: !(isEnvDevelopment && emitErrorsAsWarnings),
802
- context: paths.appSrcLib,
803
- cache: true,
804
- cacheLocation: path.resolve(
805
- paths.appNodeModules,
806
- '.cache/.eslintcache'
807
- ),
808
- // ESLint class options
809
- cwd: paths.appPath,
810
- resolvePluginsRelativeTo: __dirname,
811
- baseConfig: {
812
- extends: [require.resolve('eslint-config-react-app/base')],
813
- rules: {
814
- ...(!hasJsxRuntime && {
815
- 'react/react-in-jsx-scope': 'error',
816
- }),
817
- },
818
- },
819
- }),
820
- ].filter(Boolean),
821
- // Turn off performance processing because we utilize
822
- // our own hints via the FileSizeReporter
823
- performance: false,
824
- };
825
- };