Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
testspark317
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
wildfirecode13
testspark317
Commits
befecf6a
Commit
befecf6a
authored
Mar 17, 2021
by
wildfirecode13
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
8e2b7d61
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
43 additions
and
2 deletions
+43
-2
.DS_Store
project/.DS_Store
+0
-0
.gitignore
project/.gitignore
+3
-0
HtmlJsToES5Plugin.js
project/config/HtmlJsToES5Plugin.js
+35
-0
webpack.common.config.js
project/config/webpack.common.config.js
+3
-0
sparkrc.js
project/sparkrc.js
+1
-1
sparkrescfg.json
project/sparkrescfg.json
+1
-1
No files found.
project/.DS_Store
View file @
befecf6a
No preview for this file type
project/.gitignore
0 → 100644
View file @
befecf6a
node_modules
dist
.DS_Store
\ No newline at end of file
project/config/HtmlJsToES5Plugin.js
0 → 100644
View file @
befecf6a
const
babel
=
require
(
'@babel/core'
);
const
HtmlWebpackPlugin
=
require
(
"html-webpack-plugin"
);
class
HtmlJsToES5Plugin
{
process
(
htmlPluginData
)
{
return
new
Promise
(
function
(
resolve
)
{
const
scriptRegExp
=
/<script>
(
.|
\n)
*
?
<
\/
script>/gi
;
htmlPluginData
.
html
=
htmlPluginData
.
html
.
replace
(
scriptRegExp
,
function
(
match
)
{
const
code
=
match
.
replace
(
"<script>"
,
""
).
replace
(
"</script>"
,
""
);
const
es5Code
=
babel
.
transform
(
code
,
{
'presets'
:
[
'@babel/preset-env'
]
}).
code
;
return
`<script>
${
es5Code
}
</script>`
;
});
htmlPluginData
.
plugin
.
options
.
inject
=
false
;
resolve
();
});
};
apply
(
compiler
){
compiler
.
hooks
.
compilation
.
tap
(
'HtmlJsToES5Plugin'
,
(
compilation
)
=>
{
HtmlWebpackPlugin
.
getHooks
(
compilation
).
afterTemplateExecution
.
tapAsync
(
"HtmlJsToES5Plugin"
,
async
(
html
,
cb
)
=>
{
await
this
.
process
(
html
);
cb
(
null
,
html
);
}
);
});
}
}
exports
.
default
=
HtmlJsToES5Plugin
;
module
.
exports
=
exports
[
'default'
];
project/config/webpack.common.config.js
View file @
befecf6a
const
path
=
require
(
'path'
);
const
fs
=
require
(
"fs"
);
const
HtmlJsToES5Plugin
=
require
(
"./HtmlJsToES5Plugin"
);
const
{
SPARK_CONFIG_DIR_KEY
,
SPARK_CONFIG
}
=
require
(
'./scripts/constant'
);
const
HtmlWebpackPlugin
=
require
(
"html-webpack-plugin"
);
...
...
@@ -142,6 +144,7 @@ module.exports = function (isProd) {
// cleanOnceBeforeBuildPatterns:['**/*', 'dist'] // 这里不用写 是默认的。 路径会根据output 输出的路径去清除
}),
new
ProgressBarPlugin
(),
new
HtmlJsToES5Plugin
(),
].
filter
(
Boolean
),
optimization
:
{
minimize
:
isProd
,
...
...
project/sparkrc.js
View file @
befecf6a
...
...
@@ -9,5 +9,5 @@ module.exports ={
"IMAGE_Q1"
:
0.6
,
"IMAGE_Q2"
:
0.8
,
"RES_PATH"
:
"/src/assets/"
,
"RES_PATH_PROD"
:
"//yun.duiba.com.cn/spark/v2/sparkproject-1615946260312/16159
47628444
"
"RES_PATH_PROD"
:
"//yun.duiba.com.cn/spark/v2/sparkproject-1615946260312/16159
63701459
"
}
\ No newline at end of file
project/sparkrescfg.json
View file @
befecf6a
{
"assetsPathArr"
:[
"//yun.duiba.com.cn/spark/v2/sparkproject-1615946260312/1615947628444/index/index_bg.png"
]}
\ No newline at end of file
{
"assetsPathArr"
:[
"//yun.duiba.com.cn/spark/v2/sparkproject-1615946260312/1615963701459/index/index_bg.png"
]}
\ No newline at end of file
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