Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
najiu-admin-template
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
najiu-frontend
najiu-admin-template
Commits
4cca0071
Commit
4cca0071
authored
Dec 04, 2020
by
vben
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test(code-split): code split optimization
parent
81e90409
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
39 additions
and
5 deletions
+39
-5
CHANGELOG.zh_CN.md
CHANGELOG.zh_CN.md
+1
-0
optimizer.ts
build/vite/optimizer.ts
+20
-0
vite.config.ts
vite.config.ts
+18
-5
No files found.
CHANGELOG.zh_CN.md
View file @
4cca0071
...
...
@@ -10,6 +10,7 @@
-
还原 antdv 默认 loading,重构
`Loading`
组件,增加
`useLoading`
和
`v-loading`
指令。并增加示例
-
i18n 支持 vscode
`i18n-ally`
插件
-
新增多级路由缓存示例
-
打包代码拆分(试验)
### ⚡ Performance Improvements
...
...
build/vite/optimizer.ts
0 → 100644
View file @
4cca0071
import
type
{
GetManualChunk
,
GetManualChunkApi
}
from
'
rollup
'
;
//
const
vendorLibs
:
{
match
:
string
[];
output
:
string
}[]
=
[
{
match
:
[
'
xlsx
'
],
output
:
'
xlsx
'
,
},
];
// @ts-ignore
export
const
configManualChunk
:
GetManualChunk
=
(
id
:
string
,
api
:
GetManualChunkApi
)
=>
{
if
(
/
[\\/]
node_modules
[\\/]
/
.
test
(
id
))
{
const
matchItem
=
vendorLibs
.
find
((
item
)
=>
{
const
reg
=
new
RegExp
(
`[\\/]node_modules[\\/]_?(
${
item
.
match
.
join
(
'
|
'
)}
)(.*)`
,
'
ig
'
);
return
reg
.
test
(
id
);
});
return
matchItem
?
matchItem
.
output
:
null
;
}
};
vite.config.ts
View file @
4cca0071
...
...
@@ -3,6 +3,7 @@ import { resolve } from 'path';
import
{
modifyVars
}
from
'
./build/config/lessModifyVars
'
;
import
{
createProxy
}
from
'
./build/vite/proxy
'
;
import
{
configManualChunk
}
from
'
./build/vite/optimizer
'
;
import
globbyTransform
from
'
./build/vite/plugin/transform/globby
'
;
import
dynamicImportTransform
from
'
./build/vite/plugin/transform/dynamic-import
'
;
...
...
@@ -53,9 +54,11 @@ const viteConfig: UserConfig = {
// terser options
terserOptions
:
{
compress
:
{
keep_infinity
:
true
,
drop_console
:
VITE_DROP_CONSOLE
,
},
},
define
:
{
__VERSION__
:
pkg
.
version
,
// setting vue-i18-next
...
...
@@ -64,12 +67,14 @@ const viteConfig: UserConfig = {
__VUE_I18N_FULL_INSTALL__
:
false
,
__INTLIFY_PROD_DEVTOOLS__
:
false
,
},
cssPreprocessOptions
:
{
less
:
{
modifyVars
:
modifyVars
,
javascriptEnabled
:
true
,
},
},
// The package will be recompiled using rollup, and the new package compiled into the esm module specification will be put into node_modules/.vite_opt_cache
optimizeDeps
:
{
include
:
[
...
...
@@ -80,11 +85,6 @@ const viteConfig: UserConfig = {
],
},
proxy
:
createProxy
(
VITE_PROXY
),
plugins
:
createVitePlugins
(
viteEnv
),
rollupInputOptions
:
{
plugins
:
createRollupPlugin
(),
},
transforms
:
[
globbyTransform
({
resolvers
:
resolvers
,
...
...
@@ -94,6 +94,19 @@ const viteConfig: UserConfig = {
}),
dynamicImportTransform
(
VITE_DYNAMIC_IMPORT
),
],
proxy
:
createProxy
(
VITE_PROXY
),
plugins
:
createVitePlugins
(
viteEnv
),
rollupInputOptions
:
{
plugins
:
createRollupPlugin
(),
},
rollupOutputOptions
:
{
compact
:
true
,
manualChunks
:
configManualChunk
,
},
};
export
default
viteConfig
;
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