mirror of
https://github.com/tauri-apps/tauri.git
synced 2024-11-24 04:03:52 +03:00
fix(api): tslib path (#10681)
This commit is contained in:
parent
6b63c75504
commit
c689521a76
5
.changes/fix-tslib-path.md
Normal file
5
.changes/fix-tslib-path.md
Normal file
@ -0,0 +1,5 @@
|
||||
---
|
||||
"@tauri-apps/api": patch:bug
|
||||
---
|
||||
|
||||
Fix tslib path in dist.
|
@ -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'
|
||||
|
||||
@ -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'
|
||||
@ -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'
|
||||
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user