Skip to content

Commit

Permalink
fix(api): tslib path (#10681)
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasfernog authored Aug 19, 2024
1 parent 6b63c75 commit c689521
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changes/fix-tslib-path.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@tauri-apps/api": patch:bug
---

Fix tslib path in dist.
10 changes: 7 additions & 3 deletions tooling/api/rollup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { defineConfig, Plugin, RollupLog } from 'rollup'
import typescript from '@rollup/plugin-typescript'
import terser from '@rollup/plugin-terser'
import fg from 'fast-glob'
import { basename, join } from 'path'
import { basename, dirname, join } from 'path'
import { copyFileSync, opendirSync, rmSync, Dir } from 'fs'
import { fileURLToPath } from 'url'

Expand All @@ -27,7 +27,7 @@ export default defineConfig([
preserveModulesRoot: 'src',
entryFileNames: (chunkInfo) => {
if (chunkInfo.name.includes('node_modules')) {
return chunkInfo.name.replace('node_modules', 'external') + '.js'
return externalLibPath(chunkInfo.name) + '.js'
}

return '[name].js'
Expand All @@ -40,7 +40,7 @@ export default defineConfig([
preserveModulesRoot: 'src',
entryFileNames: (chunkInfo) => {
if (chunkInfo.name.includes('node_modules')) {
return chunkInfo.name.replace('node_modules', 'external') + '.cjs'
return externalLibPath(chunkInfo.name) + '.cjs'
}

return '[name].cjs'
Expand Down Expand Up @@ -71,6 +71,10 @@ export default defineConfig([
}
])

function externalLibPath(path: string) {
return `external/${basename(dirname(path))}/${basename(path)}`
}

function onwarn(warning: RollupLog) {
// deny warnings by default
throw Object.assign(new Error(), warning)
Expand Down

0 comments on commit c689521

Please sign in to comment.