Skip to content

Commit

Permalink
fix: avoid importBuild var collision
Browse files Browse the repository at this point in the history
  • Loading branch information
brillout committed Nov 12, 2022
1 parent 142067b commit 7d67401
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions telefunc/node/vite/plugins/importBuild/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,13 @@ function getImporterCode(config: ResolvedConfig, telefuncFilesEntry: string) {
const importPath = path.posix.relative(outDirServer, importPathAbsolute)
// console.log(`\n importPath: ${importPath}\n outDirServer: ${outDirServer}\n importPathAbsolute: ${importPathAbsolute}\n config.build.outDir: ${config.build.outDir}`)
const importerCode = [
`const { setLoaders } = require('${importPath}');`,
'setLoaders({',
` loadTelefuncFiles: () => import('./${telefuncFilesEntry}'),`,
` loadManifest: () => require('./${manifestFileName}')`,
'});',
'{',
` const { setLoaders } = require('${importPath}');`,
' setLoaders({',
` loadTelefuncFiles: () => import('./${telefuncFilesEntry}'),`,
` loadManifest: () => require('./${manifestFileName}')`,
' });',
'}',
''
].join('\n')
return importerCode
Expand Down

0 comments on commit 7d67401

Please sign in to comment.