1 | const Babel = require("@babel/core")
|
2 |
|
3 | function scriptHandle (scriptText, minifyJs) {
|
4 | // console.log(scriptText)
|
5 | // const scriptText = Templet.cutString(htmlText, "<script>", "</script>")
|
6 | if (scriptText) {
|
7 | return Babel.transform(scriptText, {
|
8 | presets: [
|
9 | "@babel/preset-env"
|
10 | ],
|
11 | plugins: ["syntax-dynamic-import"],
|
12 | compact: minifyJs, // 省略换行符和空格
|
13 | // comments: false, // 去掉注释
|
14 | })
|
15 | }
|
16 |
|
17 | }
|
18 | module.exports = scriptHandle |
\ | No newline at end of file |