Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
V
vue-project
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
zhuxichen
vue-project
Commits
a8d321bc
Commit
a8d321bc
authored
Dec 06, 2024
by
zhuxichen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chore: update
parent
cb5e98f5
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
2 deletions
+33
-2
customLoaderPlugin.ts
customLoaderPlugin.ts
+29
-0
tsconfig.node.json
tsconfig.node.json
+2
-1
vite.config.ts
vite.config.ts
+2
-1
No files found.
customLoaderPlugin.ts
0 → 100644
View file @
a8d321bc
import
{
existsSync
,
readFileSync
}
from
'fs'
;
export
default
function
customLoaderPlugin
()
{
return
{
name
:
'custom-loader-plugin'
,
transform
(
source
,
id
)
{
// 替换路径1
const
newPath
=
id
.
replace
(
/
\/
engines
\/(
.+
?)\/
/
,
'/'
);
if
(
existsSync
(
newPath
))
{
const
result
=
readFileSync
(
newPath
,
'utf-8'
);
return
{
code
:
result
,
};
}
// 替换路径2
const
newPath2
=
id
.
replace
(
/
\/
engines
\/
/
,
'/'
);
if
(
existsSync
(
newPath2
))
{
const
result
=
readFileSync
(
newPath2
,
'utf-8'
);
return
{
code
:
result
,
};
}
// 如果没有匹配到,返回原始 source
return
source
;
},
};
}
tsconfig.node.json
View file @
a8d321bc
...
@@ -5,7 +5,8 @@
...
@@ -5,7 +5,8 @@
"vitest.config.*"
,
"vitest.config.*"
,
"cypress.config.*"
,
"cypress.config.*"
,
"nightwatch.conf.*"
,
"nightwatch.conf.*"
,
"playwright.config.*"
"playwright.config.*"
,
"customLoaderPlugin.ts"
],
],
"compilerOptions"
:
{
"compilerOptions"
:
{
"composite"
:
true
,
"composite"
:
true
,
...
...
vite.config.ts
View file @
a8d321bc
...
@@ -4,7 +4,7 @@ import Components from 'unplugin-vue-components/vite';
...
@@ -4,7 +4,7 @@ import Components from 'unplugin-vue-components/vite';
import
AutoImport
from
'unplugin-auto-import/vite'
;
import
AutoImport
from
'unplugin-auto-import/vite'
;
import
{
AntDesignVueResolver
}
from
'unplugin-vue-components/resolvers'
;
import
{
AntDesignVueResolver
}
from
'unplugin-vue-components/resolvers'
;
import
path
from
'path'
;
import
path
from
'path'
;
import
fs
from
'fs
'
;
import
customLoaderPlugin
from
'./customLoaderPlugin
'
;
// 当前主题的存储
// 当前主题的存储
let
currentTheme
:
Record
<
string
,
string
>
=
{};
let
currentTheme
:
Record
<
string
,
string
>
=
{};
...
@@ -48,6 +48,7 @@ export default defineConfig(async ({ mode }) => {
...
@@ -48,6 +48,7 @@ export default defineConfig(async ({ mode }) => {
resolvers
:
[
AntDesignVueResolver
()],
resolvers
:
[
AntDesignVueResolver
()],
dts
:
'src/auto-imports.d.ts'
,
dts
:
'src/auto-imports.d.ts'
,
}),
}),
customLoaderPlugin
(),
],
],
css
:
{
css
:
{
preprocessorOptions
:
{
preprocessorOptions
:
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment