Skip to content

Commit

Permalink
Add jsconfig file in nextjs project
Browse files Browse the repository at this point in the history
  • Loading branch information
pascaionut12345 committed Dec 3, 2024
1 parent 97d0abb commit 77c7eac
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export const USE_ROUTER_HOOK: UIDLExternalDependency = {

export const USE_GLOBAL_CONTEXT_HOOK: UIDLDependency = {
type: 'local',
path: '../global-context',
path: '@/global-context',
meta: {
namedImport: true,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,18 @@ const findFileInTemplate = (
return file
}

const generateJsConfigFile = () => {
return `
{
"compilerOptions": {
"baseUrl": ".",
"paths": {
"@/*": ["./*"]
}
}
}`
}

const generateGlobalContextFileContent = (
locales: Record<string, string>,
main: {
Expand Down Expand Up @@ -151,6 +163,18 @@ export class NextProjectPlugini18nConfig implements ProjectPlugin {
],
})

const jsConfigFile = generateJsConfigFile()
files.set('jsconfig.json', {
path: [],
files: [
{
name: 'jsconfig',
content: jsConfigFile,
fileType: FileType.JSON,
},
],
})

return structure
}
}

0 comments on commit 77c7eac

Please sign in to comment.