-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
applied https://codesandbox.io/s/y4ev2?file=/package.json from wojtek…
…maj/react-pdf#136 result compiled successfully
- Loading branch information
1 parent
c7a2e47
commit fb43221
Showing
4 changed files
with
38 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
module.exports = { | ||
future: { | ||
webpack5: true | ||
}, | ||
webpack: (config) => { | ||
// load worker files as a urls with `file-loader` | ||
config.module.rules.unshift({ | ||
test: /pdf\.worker\.(min\.)?js/, | ||
use: [ | ||
{ | ||
loader: "file-loader", | ||
options: { | ||
name: "[contenthash].[ext]", | ||
publicPath: "_next/static/worker", | ||
outputPath: "static/worker" | ||
} | ||
} | ||
] | ||
}); | ||
|
||
return config; | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,10 @@ | ||
import App from './InvoicesGenerator/App.js'; | ||
import dynamic from "next/dynamic"; | ||
|
||
export default function RenderUserDashboard() { | ||
return( | ||
<> | ||
|
||
<App /> | ||
|
||
</> | ||
) | ||
const PDFViewer = dynamic(() => import("./InvoicesGenerator/App.js"), { | ||
ssr: false | ||
}); | ||
|
||
export default function PDF() { | ||
return <PDFViewer />; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
if (process.env.NODE_ENV === "production") { | ||
// use minified verion for production | ||
module.exports = require("pdfjs-dist/build/pdf.worker.min.js"); | ||
} else { | ||
module.exports = require("pdfjs-dist/build/pdf.worker.js"); | ||
} |