智能照明系统APP-本地串口
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
LightingSystemApp-serial/.svn/pristine/28/280335e212af44eb5b52e6111b1...

60 lines
1.5 KiB

const path = require('path')
const webpack = require('webpack')
const {
normalizePath,
isInHBuilderX
} = require('@dcloudio/uni-cli-shared/lib/util')
const isWin = /^win/.test(process.platform)
function genTranspileDepRegex (depPath) {
return new RegExp(isWin
? depPath.replace(/\\/g, '\\\\') // double escape for windows style path
: depPath)
}
let sourceRoot = false
function getSourceRoot () {
if (!sourceRoot) {
if (isInHBuilderX) {
sourceRoot = normalizePath(process.env.UNI_INPUT_DIR)
} else {
sourceRoot = normalizePath(process.env.UNI_CLI_CONTEXT)
}
}
return sourceRoot
}
function moduleFilenameTemplate (info) {
if (!info.allLoaders && info.resourcePath) {
const filepath = normalizePath(path.relative(getSourceRoot(), info.absoluteResourcePath))
if (filepath.indexOf('../') === 0) {
return
}
return `uni-app:///${filepath}`
}
}
const exclude = [/pages\.json/, /node_modules/, /vue&type=template/, /vue&type=style/]
module.exports = {
createSourceMapDevToolPlugin (filename = false) {
const options = {
test: [/\.js$/],
exclude,
moduleFilenameTemplate
}
if (filename) {
options.filename = '../.sourcemap/' + process.env.UNI_PLATFORM + '/[name].js.map'
}
return new webpack.SourceMapDevToolPlugin(options)
},
createEvalSourceMapDevToolPlugin () {
return new webpack.EvalSourceMapDevToolPlugin({
test: genTranspileDepRegex(process.env.UNI_INPUT_DIR),
exclude,
moduleFilenameTemplate
})
}
}