Skip to content

Commit 082b876

Browse files
authored
Merge pull request #80160 from andriivitiv/76303-upgrade-react-fast-pdf-and-webpack
Upgrade `react-fast-pdf` and `webpack`
2 parents ffa33e9 + 0064ae7 commit 082b876

5 files changed

Lines changed: 298 additions & 292 deletions

File tree

config/webpack/webpack.common.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -162,8 +162,8 @@ const getCommonConfiguration = ({file = '.env', platform = 'web'}: Environment):
162162
{from: 'assets/fonts/web', to: 'fonts'},
163163
{from: 'assets/sounds', to: 'sounds'},
164164
{from: 'assets/pdfs', to: 'pdfs'},
165-
{from: 'node_modules/react-pdf/dist/esm/Page/AnnotationLayer.css', to: 'css/AnnotationLayer.css'},
166-
{from: 'node_modules/react-pdf/dist/esm/Page/TextLayer.css', to: 'css/TextLayer.css'},
165+
{from: 'node_modules/react-pdf/dist/Page/AnnotationLayer.css', to: 'css/AnnotationLayer.css'},
166+
{from: 'node_modules/react-pdf/dist/Page/TextLayer.css', to: 'css/TextLayer.css'},
167167
{from: '.well-known/apple-app-site-association', to: '.well-known/apple-app-site-association', toType: 'file'},
168168
{from: '.well-known/assetlinks.json', to: '.well-known/assetlinks.json'},
169169

@@ -260,7 +260,7 @@ const getCommonConfiguration = ({file = '.env', platform = 'web'}: Environment):
260260
// We are importing this worker as a string by using asset/source otherwise it will default to loading via an HTTPS request later.
261261
// This causes issues if we have gone offline before the pdfjs web worker is set up as we won't be able to load it from the server.
262262
{
263-
test: new RegExp('node_modules/pdfjs-dist/build/pdf.worker.min.mjs'),
263+
test: new RegExp('node_modules/pdfjs-dist/legacy/build/pdf.worker.min.mjs'),
264264
type: 'asset/source',
265265
},
266266

@@ -330,6 +330,8 @@ const getCommonConfiguration = ({file = '.env', platform = 'web'}: Environment):
330330
'victory-native': path.resolve(dirname, '../../node_modules/victory-native/src/index.ts'),
331331
// Required for @shopify/react-native-skia web support
332332
'react-native/Libraries/Image/AssetRegistry': false,
333+
// Use legacy build of pdfjs-dist to support older browsers
334+
'pdfjs-dist$': path.resolve(dirname, '../../node_modules/pdfjs-dist/legacy/build/pdf.mjs'),
333335
// Module alias for web
334336
// https://webpack.js.org/configuration/resolve/#resolvealias
335337
'@assets': path.resolve(dirname, '../../assets'),

0 commit comments

Comments
 (0)