Skip to content

Commit

Permalink
Improve(Cross Import): Remove sucrase package
Browse files Browse the repository at this point in the history
  • Loading branch information
1aron committed Dec 19, 2024
1 parent 59cb7cd commit fcbb7f3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 13 deletions.
4 changes: 2 additions & 2 deletions packages/cross-import/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@
"dist"
],
"dependencies": {
"sucrase": "^3.35.0",
"jiti": "^2.4.1"
"jiti": "^2.4.1",
"sucrase": "^3.35.0"
},
"devDependencies": {
"@master/css": "2.0.0-rc.24"
Expand Down
14 changes: 3 additions & 11 deletions packages/cross-import/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
import { transform } from 'sucrase'
/**
* Use the jiti/dist/jiti module to prevent bundling of redundant dependencies such as babel.
*/
import { createJiti } from 'jiti'

export default function crossImport(modulePath: string): any {
Expand All @@ -21,15 +17,11 @@ export default function crossImport(modulePath: string): any {
console.error(error)
console.log('[cross-import] fall back to sucrase runtime transform:', modulePath)
}
return createJiti(__filename, {
return createJiti(import.meta.url, {
cache: false,
debug: !!process.env.DEBUG,
transform: (options) => {
return transform(options.source, {
transforms: ['imports', 'typescript'],
filePath: options.filename
})
}
fsCache: false,
moduleCache: false,
})(modulePath)
}
}

0 comments on commit fcbb7f3

Please sign in to comment.