DEV Community

Need help with next.config.js

isaack okello brian on October 01, 2020

How can i write this without having it throw an error? const withSass = require("@zeit/next-sass"); const withLess = require("@zeit/next-less");...
Collapse
 
alejandronanez profile image
Alejandro Ñáñez Ortiz •

This is a bit difficult to read, I'd suggest using

``` so the code looks a bit better.

Still, I think that your problem is that you have



module.exports = webpack: (config) => {


And it should be



module.exports = (config) => {


Collapse
 
kulgeek profile image
isaack okello brian •

I still get an error but I uploaded a cover photo

Collapse
 
kulgeek profile image
isaack okello brian •

And the rest should remain as is? Sorry im super new to this, can you rewrite the whole of it. Teach me sensei

Collapse
 
kulgeek profile image
isaack okello brian •

Heres the polacode

Collapse
 
alejandronanez profile image
Alejandro Ñáñez Ortiz •

No worries, everyone has been new to something in their life.

I should try with what I suggested and paste the error again, remember to wrap your code within


Thread Thread
 
kulgeek profile image
isaack okello brian •

Okay let me try that

Collapse
 
kulgeek profile image
isaack okello brian •

ERROR:

yarn run v1.22.4
warning ../package.json: No license field
$ next dev
/Users/isaackbrian/Documents/WORKSPACE/Dev/rds-app/next.config.js:13
module.exports = webpack: (config) => {
^

SyntaxError: Unexpected token ':'
at wrapSafe (internal/modules/cjs/loader.js:1172:16)
at Module._compile (internal/modules/cjs/loader.js:1220:27)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1277:10)
at Module.load (internal/modules/cjs/loader.js:1105:32)
at Function.Module._load (internal/modules/cjs/loader.js:967:14)
at Module.require (internal/modules/cjs/loader.js:1145:19)
at require (internal/modules/cjs/helpers.js:75:18)
at loadConfig (/Users/isaackbrian/Documents/WORKSPACE/Dev/rds-app/node_modules/next/dist/next-server/server/config.js:6:116)
at new Server (/Users/isaackbrian/Documents/WORKSPACE/Dev/rds-app/node_modules/next/dist/next-server/server/next-server.js:1:3860)
at new DevServer (/Users/isaackbrian/Documents/WORKSPACE/Dev/rds-app/node_modules/next/dist/server/next-dev-server.js:1:2964)
error Command failed with exit code 1.
info Visit yarnpkg.com/en/docs/cli/run for documentation about this command.

Collapse
 
kulgeek profile image
isaack okello brian •