Skip to content

Commit 93a2f5c

Browse files
authoredMar 23, 2023
feat(injectAtEnd): add new option (#327)
Co-authored-by: 121016171 <121016171@qq.com>
1 parent c5a5fcc commit 93a2f5c

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed
 

‎src/core/ctx.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,14 @@ export function createContext(options: Options = {}, root = process.cwd()) {
3131
const cachePath = isCache === false
3232
? false
3333
: resolve(root, typeof isCache === 'string' ? isCache : 'node_modules/.cache/unplugin-auto-import.json')
34+
35+
// When "options.injectAtEnd" is undefined or true, it's true.
36+
const injectAtEnd = options.injectAtEnd !== false
3437

3538
const unimport = createUnimport({
3639
imports: [],
3740
presets: [],
38-
injectAtEnd: true,
41+
injectAtEnd,
3942
addons: [
4043
...(options.vueTemplate ? [vueTemplateAddon()] : []),
4144
resolversAddon(resolvers),

‎src/types.ts

+7
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,13 @@ export interface Options {
8383
*/
8484
ignore?: (string | RegExp)[]
8585

86+
/**
87+
* Inject the imports at the end of other imports
88+
*
89+
* @default true
90+
*/
91+
injectAtEnd?: boolean
92+
8693
/**
8794
* Path for directories to be auto imported
8895
*/

0 commit comments

Comments
 (0)
Please sign in to comment.