frankcollins3 / PHPokedex

react concepts
0 stars 0 forks source link

To Change source directory in Next/Pages [10:14am] #1

Closed frankcollins3 closed 1 year ago

frankcollins3 commented 1 year ago

https://stackoverflow.com/questions/62150887/how-to-change-nextjs-root-path-page:

this comment from this ^ ^ stack overflow question is what I instinctively did on my last app: "There should be a standard way, but here's what I did: I cleared the content in my index.js, imported my home.js into it, then I rendered it as its content."

proposed solutions:

1) I was checking if this key from the compilerOptions:{ } object from tsconfig.json could do anything: "paths": { "@/": ["./"] }

2) the react approach of populating the main key with a value that is a relative path of one of the destination. "main": "pages/allpokemon.tsx"

frankcollins3 commented 1 year ago

**this code comes from an answer to the same stack overflow question posted above:**

module.exports = {
  experimental: {
    async redirects() {
      return [
        { source: '/', destination: '/home', permanent: true }, // a permanent redirect
      ];
    },
  },
};

I also did something similar to this in my last app before it was proving to be a shaky solution My solution was housed in the /app.tsx though and the condition checked for the URL endpoint from next Router() object

[10:16am]

frankcollins3 commented 1 year ago

for now I"m leaving it and doing it the old way since the purpose of spinning up this prototype is to: get to running some PHP expressions as fast as possible

and this is only steering away from that solution.