Comments (13)
Ok, so based on my discussion at Payload's official discord (https://discord.com/channels/967097582721572934/1128234019012743241) this can be resolved by following the below steps
- use
withPayload
- add the problematic plugin
@payloadcms/plugin-seo
in transpilePackages - boom
transpilePackages: ['@react-three/postprocessing', '@payloadcms/plugin-form-builder', '@payloadcms/plugin-seo'],
from plugin-seo.
@onepoordeveloper amazing! Some context here: transpiling is necessary when importing raw .scss
files (like some Payload components do). Next.js will transpile scss modules just fine, but Payload is intentionally not using scss modules to promote css customization and style overrides.
from plugin-seo.
@rpfaeffle I'm facing this also on my localhost. Did you find a solution?
from plugin-seo.
Hey @onepoordeveloper,
my currrent workaround is adding the fields manually without the features provided by the plugin.
from plugin-seo.
@JarrodMFlesch do you have any idea what might be going on here? Would #45 fix this?
from plugin-seo.
any update on this plz?
from plugin-seo.
Hey @rpfaeffle and @onepoordeveloper, it looks like that error is because the plugin imports a React component that uses scss and the compiler does not recognize the syntax. Do either of you have sass
installed in your Next.js app? I believe Next.js natively supports it, so all you have to is run yarn add sass
or npm i --save sass
and no additional setup is needed. Give that a try and let me know if the error persists!
from plugin-seo.
Hey @jacobsfletch,
I do have sass
as well as sass-loader
installed in my Next.js app. Do you think the error might be related to the fact that I am using pnpm
as my package manager?
from plugin-seo.
@jacobsfletch thank you for the response.
I had sass
in my project. I realized that it is not needed so I
- removed it from
package.json
- removed
node_modules
directory - removed
package-lock.json
- ran
npm i
- and
npm run dev
and the error still persists.
I also attempted the install with yarn
but had no success.
from plugin-seo.
@jacobsfletch I noticed the same error appears when I am using @payloadcms/plugin-form-builder
This is my configuration, results are same if I keep everything to default like formBuilder({})
.
@import '../../../scss/styles.scss';
^
SyntaxError: Invalid or unexpected token
at internalCompileFunction (node:internal/vm:73:18)
at wrapSafe (node:internal/modules/cjs/loader:1176:20)
at Module._compile (node:internal/modules/cjs/loader:1218:27)
at Module._extensions..js (node:internal/modules/cjs/loader:1308:10)
at Module.load (node:internal/modules/cjs/loader:1117:32)
at Module._load (node:internal/modules/cjs/loader:958:12)
at Module.require (node:internal/modules/cjs/loader:1141:19)
at require (node:internal/modules/cjs/helpers:110:18)
at Object.<anonymous> (/Users/ahmad/projects/f44/yungo/node_modules/payload/dist/admin/components/forms/Label/index.js:9:1)
at Module._compile (node:internal/modules/cjs/loader:1254:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1308:10)
at Module.load (node:internal/modules/cjs/loader:1117:32)
at Module._load (node:internal/modules/cjs/loader:958:12)
at Module.require (node:internal/modules/cjs/loader:1141:19)
at require (node:internal/modules/cjs/helpers:110:18)
at Object.<anonymous> (/Users/ahmad/projects/f44/yungo/node_modules/payload/dist/admin/components/forms/field-types/Text/Input.js:8:33)
at Module._compile (node:internal/modules/cjs/loader:1254:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1308:10)
at Module.load (node:internal/modules/cjs/loader:1117:32)
at Module._load (node:internal/modules/cjs/loader:958:12)
at Module.require (node:internal/modules/cjs/loader:1141:19)
at require (node:internal/modules/cjs/helpers:110:18)
at Object.<anonymous> (/Users/ahmad/projects/f44/yungo/node_modules/payload/dist/admin/components/forms/field-types/Text/index.js:33:33)
at Module._compile (node:internal/modules/cjs/loader:1254:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1308:10)
at Module.load (node:internal/modules/cjs/loader:1117:32)
at Module._load (node:internal/modules/cjs/loader:958:12)
at Module.require (node:internal/modules/cjs/loader:1141:19)
at require (node:internal/modules/cjs/helpers:110:18)
at Object.<anonymous> (/Users/ahmad/projects/f44/yungo/node_modules/payload/components/forms.js:27:16)
at Module._compile (node:internal/modules/cjs/loader:1254:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1308:10)
at Module.load (node:internal/modules/cjs/loader:1117:32)
at Module._load (node:internal/modules/cjs/loader:958:12)
at Module.require (node:internal/modules/cjs/loader:1141:19)
at require (node:internal/modules/cjs/helpers:110:18)
at Object.<anonymous> (/Users/ahmad/projects/f44/yungo/node_modules/@payloadcms/plugin-form-builder/dist/collections/Forms/DynamicFieldSelector.js:40:15)
at Module._compile (node:internal/modules/cjs/loader:1254:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1308:10)
at Module.load (node:internal/modules/cjs/loader:1117:32)
at Module._load (node:internal/modules/cjs/loader:958:12)
at Module.require (node:internal/modules/cjs/loader:1141:19)
at require (node:internal/modules/cjs/helpers:110:18)
at Object.<anonymous> (/Users/ahmad/projects/f44/yungo/node_modules/@payloadcms/plugin-form-builder/dist/collections/Forms/fields.js:15:30)
at Module._compile (node:internal/modules/cjs/loader:1254:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1308:10)
at Module.load (node:internal/modules/cjs/loader:1117:32)
at Module._load (node:internal/modules/cjs/loader:958:12)
at Module.require (node:internal/modules/cjs/loader:1141:19)
at require (node:internal/modules/cjs/helpers:110:18) {
page: '/'
}
from plugin-seo.
I am getting the same Sass build issue but I am using Payload independently of Next.js. It happens as soon as the SEO plugin is used. How can I fix this case?
ts-node fails to load the Sass file:
[nodemon] starting `ts-node --project tsconfig.server.json src/payload/server.ts`
/.../node_modules/payload/dist/admin/components/forms/Label/index.scss:1
@import '../../../scss/styles.scss';
^
SyntaxError: Invalid or unexpected token
at internalCompileFunction (node:internal/vm:73:18)
at wrapSafe (node:internal/modules/cjs/loader:1175:20)
at Module._compile (node:internal/modules/cjs/loader:1219:27)
at Module._extensions..js (node:internal/modules/cjs/loader:1309:10)
at Object.require.extensions.<computed> [as .js] (/.../node_modules/ts-node/src/index.ts:1608:43)
at Module.load (node:internal/modules/cjs/loader:1113:32)
at Function.Module._load (node:internal/modules/cjs/loader:960:12)
at Module.require (node:internal/modules/cjs/loader:1137:19)
at require (node:internal/modules/helpers:121:18)
at Object.<anonymous> (/.../node_modules/payload/src/admin/components/forms/Label/index.tsx:8:1)
from plugin-seo.
I was facing the exact same issue and you can use my last comment above as a guide on how I fixed it.
from plugin-seo.
@onepoordeveloper I am using Payload directly not through Next.js. Therefore your workaround does not apply. It's failing in this case in dev mode and also as transpiled TypeScript.
I think the problem is a different one: some client code processed through Webpack is referenced by the SEO plugin and gets used in backend code. In this case Webpack Sass is not supported.
from plugin-seo.
Related Issues (20)
- Are Translations Supported? HOT 1
- Re-Use fancy Min/Max Lenght for other fields HOT 1
- Tabbed UI breaks position 'sidebar' HOT 3
- Validation issue on save HOT 4
- Disable tabs nesting HOT 2
- Search by ID only with tabbedUI: true HOT 3
- Display added alt/title on Media when used HOT 1
- Text cursor jumps to end of content HOT 1
- Feat request: Add focus keywords or keyphrase HOT 1
- forms_1.useAllFormFields is not a function HOT 2
- Auto-generate buttons are there even if no generateTitle/generateDescription/etc configured HOT 5
- TabbedUI breaks content fields with `position: 'sidebar'` HOT 11
- Allow custom more fields in SEO group? HOT 4
- Nothing displaying in admin panel HOT 2
- Add opengraph support HOT 2
- Fields not rendering in collection when SEO is enabled since v1.0.12 HOT 4
- How to access collection slug inside `generateURL`? HOT 4
- Input is broken on latest payload HOT 1
- Using S3 Adapter, og:image + twitter:image set to SITE_URL/S3_IMAGE_URL HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from plugin-seo.