This repository has been archived on 2023-08-30. You can view files and clone it, but cannot push or open issues/pull-requests.
bytedo
/
wcui
Archived
1
0
Fork 0

修正next的配置,自动补全js文件的后缀

old
宇天 2018-05-23 18:36:35 +08:00
parent 76665f6b51
commit c1b678569d
1 changed files with 4 additions and 1 deletions

View File

@ -28,7 +28,10 @@ const compileJs = (entry, output) => {
let t1 = Date.now() let t1 = Date.now()
let buf = fs.cat(entry).toString() let buf = fs.cat(entry).toString()
let { code } = uglify.minify(buf) let { code } = uglify.minify(buf)
code = code.replace(/\.scss/g, '.css') code = code
.replace(/\.scss/g, '.css')
.replace(/import"([a-z0-9/.]*)(?<!\.css)"/g, 'import "$1.js"')
.replace(/import ([\w]*) from"([a-z0-9/.]*)"/g, 'import $1 from "$2.js"')
log( log(
'编译JS: %s, 耗时 %s ms', '编译JS: %s, 耗时 %s ms',
chalk.green(entry), chalk.green(entry),