-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Help with barebones Next.js and Paper.js project #2050
Comments
As you have messages about jsdom, I would try using paper-jsdom or paper-jsdom-canvas packages instead of paper. |
I'm running into this same issue with Nuxt 3.8.0. Seems the newest framework versions are expecting something different from importing the paper module. Here's my reproduction of the issue: https://stackblitz.com/edit/github-dspzws |
just came looking for a solution to the same error. @SixK i am assuming @thomas901 is not trying to render on node, but is trying to render on the client, as his 'use client' directive means. That said, seems like something is triggering paper to assume it should be rendering on the server, hence the error? |
tried out a fix someone made with gatsby, which also uses webpack, but sadly still didn't work: /** @type {import('next').NextConfig} */
const nextConfig = {
webpack: (config, { isServer }) => ({
...config,
module: {
...config.module,
rules: [
...config.module.rules,
...(isServer
? [
{
test: /node_modules\/paper/,
use: 'null-loader',
},
]
: []),
],
},
}),
}
module.exports = nextConfig related: #1483 |
Anyone figure this out? Having the same issue |
What worked for me (Next.js v. 14) was to ensure that Paper.js is ignored in the server code by setting a webpack alias. next.config.mjs /** @type {import('next').NextConfig} */
const nextConfig = {
// ...other settings
webpack: (config, { isServer }) => {
if (isServer) {
config.resolve.alias['paper'] = false;
}
return config;
},
};
export default nextConfig; |
This worked for me, thank you so much 🙌 |
Description/Steps to reproduce
Hi I can't seem to get Paper.js working with an empty Next.js project. If anyone could offer some help with a basic working example that would be great.
npm i
npm run dev
In
src/app/page.tsx
Resulting error:
Link to reproduction test-case
https://github.com/thomas901/minimal-reproduction
Expected result
Should run without any errors.
Additional information
The text was updated successfully, but these errors were encountered: