How can i write this without having it throw an error?
const withSass = require("@zeit/next-sass");
const withLess = require("@zeit/next-less");
const withCSS = require("@zeit/next-css");
const path = require("path");
const isProd = process.env.NODE_ENV === "production";
// fix: prevents error when .less files are required by node
if (typeof require !== "undefined") {
require.extensions[".less"] = (file) => {};
}
module.exports = webpack: (config) => {
config.resolve.alias['components'] = path.join(dirname,'components')
config.resolve.alias['public'] = path.join(dirname,'public')
return config;
},withCSS({
cssModules: true,
cssLoaderOptions: {
importLoaders: 1,
localIdentName: "[local]___[hash:base64:5]",
},
...withLess(
withSass({
lessLoaderOptions: {
javascriptEnabled: true,
},
})
),
});
Top comments (13)
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
And it should be
Heres the polacode
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
Okay let me try that
@alejandro
dev-to-uploads.s3.amazonaws.com/i/...
Theres the error - can you see the screenshots?
What error are you getting? 🤔
Do you have it on a repo/gist or something?
@alejandro Ñanez Ortiz here is a github link github.com/kulgeek/rds-app/blob/ma...
And the rest should remain as is? Sorry im super new to this, can you rewrite the whole of it. Teach me sensei
I still get an error but I uploaded a cover photo
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.
dev-to-uploads.s3.amazonaws.com/i/...