Skip to content

Commit 4ce553d

Browse files
authored
feat: migrate PDF viewer to DIAL highlighter (#122)
1 parent 93b4779 commit 4ce553d

14 files changed

Lines changed: 821 additions & 1099 deletions

File tree

next.config.mjs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,29 @@
1+
import { fileURLToPath } from 'node:url';
2+
3+
const pdfJsWebpackCompatibilityLoader = fileURLToPath(
4+
new URL('./webpack/pdfJsWebpackCompatibilityLoader.cjs', import.meta.url),
5+
);
6+
17
/** @type {import('next').NextConfig} */
28
const nextConfig = () => {
39
return {
410
output: 'standalone',
511
experimental: {
612
instrumentationHook: true,
713
},
8-
webpack(config, { isServer }) {
14+
webpack(config, { dev, isServer }) {
915
if (isServer) {
1016
config.resolve.alias.canvas = false;
1117
}
1218

19+
if (dev && !isServer) {
20+
config.module.rules.push({
21+
test: /pdfjs-dist[\\/]build[\\/]pdf\.mjs$/,
22+
enforce: 'pre',
23+
use: pdfJsWebpackCompatibilityLoader,
24+
});
25+
}
26+
1327
config.experiments = {
1428
asyncWebAssembly: true,
1529
layers: true,

0 commit comments

Comments
 (0)