-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5e07a71
commit 74a69ac
Showing
10 changed files
with
1,264 additions
and
197 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -89,7 +89,7 @@ out | |
|
||
# Nuxt.js build / generate output | ||
.nuxt | ||
dist | ||
# dist | ||
|
||
# Gatsby files | ||
.cache/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { defineBuildConfig } from 'unbuild' | ||
|
||
export default defineBuildConfig({ | ||
entries: [ | ||
'src/index', | ||
], | ||
declaration: true, | ||
clean: true, | ||
rollup: { | ||
emitCJS: true, | ||
// dts: { | ||
// compilerOptions:{} | ||
// } | ||
}, | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
'use strict'; | ||
|
||
function globalConst(config) { | ||
return { | ||
name: "vite-plugin-global-const", | ||
config() { | ||
const define = defineConstCore(config); | ||
return { | ||
define | ||
}; | ||
} | ||
}; | ||
} | ||
function defineConstCore(config) { | ||
const define = {}; | ||
for (const key in config) { | ||
define[`import.meta.env.${key}`] = JSON.stringify(config[key]); | ||
} | ||
return define; | ||
} | ||
|
||
exports.defineConstCore = defineConstCore; | ||
exports.globalConst = globalConst; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
function globalConst(config) { | ||
return { | ||
name: "vite-plugin-global-const", | ||
config() { | ||
const define = defineConstCore(config); | ||
return { | ||
define | ||
}; | ||
} | ||
}; | ||
} | ||
function defineConstCore(config) { | ||
const define = {}; | ||
for (const key in config) { | ||
define[`import.meta.env.${key}`] = JSON.stringify(config[key]); | ||
} | ||
return define; | ||
} | ||
|
||
export { defineConstCore, globalConst }; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
import { Plugin } from 'vite'; | ||
import { Plugin as VitePlugin } from 'vite'; | ||
interface Config { | ||
[key: string]: any; | ||
} | ||
export declare function globalConst(config: Config): Plugin; | ||
export declare function globalConst(config: Config): VitePlugin; | ||
export declare function defineConstCore(config: Config): {}; | ||
export {}; |
Oops, something went wrong.