Skip to content

Commit

Permalink
Merge pull request #53080 from callstack-internal/VickyStash/bugfix/5…
Browse files Browse the repository at this point in the history
…1313-remove-pdf-console-errors

Fix console errors during PDF attachment preview
  • Loading branch information
tylerkaraszewski authored Dec 2, 2024
2 parents 4be4603 + 0ac24b3 commit 9245b2d
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .storybook/webpack.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ const webpackConfig = ({config}: {config: Configuration}) => {
});

config.module.rules?.push({
test: /pdf\.worker\.mjs$/,
test: /pdf\.worker\.min\.mjs$/,
type: 'asset/source',
});

Expand Down
2 changes: 1 addition & 1 deletion config/webpack/webpack.common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ const getCommonConfiguration = ({file = '.env', platform = 'web'}: Environment):
// We are importing this worker as a string by using asset/source otherwise it will default to loading via an HTTPS request later.
// 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.
{
test: new RegExp('node_modules/pdfjs-dist/legacy/build/pdf.worker.mjs'),
test: new RegExp('node_modules/pdfjs-dist/legacy/build/pdf.worker.min.mjs'),
type: 'asset/source',
},

Expand Down
9 changes: 5 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@
"react-content-loader": "^7.0.0",
"react-dom": "18.3.1",
"react-error-boundary": "^4.0.11",
"react-fast-pdf": "1.0.15",
"react-fast-pdf": "1.0.20",
"react-map-gl": "^7.1.3",
"react-native": "0.75.2",
"react-native-android-location-enabler": "^2.0.1",
Expand Down
2 changes: 1 addition & 1 deletion src/components/PDFThumbnail/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import 'core-js/proposals/promise-with-resolvers';
// eslint-disable-next-line import/extensions
import pdfWorkerSource from 'pdfjs-dist/legacy/build/pdf.worker.mjs';
import pdfWorkerSource from 'pdfjs-dist/legacy/build/pdf.worker.min.mjs';
import React, {useMemo, useState} from 'react';
import {View} from 'react-native';
import {Document, pdfjs, Thumbnail} from 'react-pdf';
Expand Down
2 changes: 1 addition & 1 deletion src/types/modules/pdf.worker.d.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
declare module 'pdfjs-dist/legacy/build/pdf.worker.mjs';
declare module 'pdfjs-dist/legacy/build/pdf.worker.min.mjs';

0 comments on commit 9245b2d

Please sign in to comment.