Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
V
vue-cli-plugin-ts-multi-pages
Project
Project
Details
Activity
Releases
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
shangbj
vue-cli-plugin-ts-multi-pages
Commits
52511638
Commit
52511638
authored
May 17, 2020
by
尚斌杰
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加build exclude
parent
b3c897db
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
2 deletions
+7
-2
build.js
commands/build.js
+7
-2
No files found.
commands/build.js
View file @
52511638
const
fs
=
require
(
'fs-extra'
)
const
path
=
require
(
'path'
)
const
chalk
=
require
(
'chalk'
)
const
pkg
=
require
(
`
${
process
.
cwd
()}
/package.json`
)
const
defaults
=
{
clean
:
true
,
...
...
@@ -17,8 +18,12 @@ const buildModes = {
if
(
!
fs
.
existsSync
(
path
.
resolve
(
'./src/pages'
))){
fs
.
mkdirSync
(
path
.
resolve
(
'./src/pages'
))
}
const
commonPath
=
pkg
.
commonPath
||
(
pkg
.
vueCliBuildConfig
&&
pkg
.
vueCliBuildConfig
.
commonPath
)
const
excludePages
=
(
pkg
.
vueCliBuildConfig
&&
pkg
.
vueCliBuildConfig
.
exclude
)?
pkg
.
vueCliBuildConfig
.
exclude
:
[]
const
allPages
=
[]
const
dirs
=
fs
.
readdirSync
(
path
.
resolve
(
'./src/pages/'
)).
filter
(
page
=>
(
page
!==
'.DS_Store'
&&
page
!==
'common'
))
const
dirs
=
fs
.
readdirSync
(
path
.
resolve
(
'./src/pages/'
)).
filter
(
page
=>
(
page
!==
'.DS_Store'
&&
excludePages
.
indexOf
(
page
)
<
0
))
for
(
let
index
=
0
;
index
<
dirs
.
length
;
index
++
)
{
const
dirName
=
dirs
[
index
];
if
(
fs
.
existsSync
(
`
${
process
.
cwd
()}
/src/pages/
${
dirName
}
/index.ts`
)
&&
dirName
!==
'common'
){
...
...
@@ -212,7 +217,7 @@ async function build (args, api, options) {
item
.
options
.
template
=
pagePath
+
'/index.html'
item
.
options
.
header
=
headerTpl
item
.
options
.
footer
=
footerTpl
item
.
options
.
common
=
(
commonPath
&&
process
.
env
.
NODE_ENV
===
'production'
)?
`<script src="
${
commonPath
}
"></script>`
:
''
item
.
options
.
common
=
(
commonPath
&&
process
.
env
.
NODE_ENV
===
'production'
)?
`<
link href=
${
commonPath
}
rel=preload as=script><
script src="
${
commonPath
}
"></script>`
:
''
}
}
for
(
let
item
of
webpackConfig
.
module
.
rules
)
{
...
...
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