Skip to content

Commit

Permalink
Merge pull request #951 from teleporthq/add-jsconfig-file
Browse files Browse the repository at this point in the history
Add jsconfig file in nextjs project
  • Loading branch information
vladgrecu authored Dec 3, 2024
2 parents 3ac5a42 + 77c7eac commit 045be55
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 045be55

Please sign in to comment.