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.
16 lines
424 B
16 lines
424 B
|
3 years ago
|
const isWin = /^win/.test(process.platform)
|
||
|
|
|
||
|
|
const normalizePath = path => (isWin ? path.replace(/\\/g, '/') : path)
|
||
|
|
|
||
|
|
const src = require('@dcloudio/uni-h5/path').src
|
||
|
|
|
||
|
|
module.exports = function (content) {
|
||
|
|
this.cacheable && this.cacheable()
|
||
|
|
const resourcePath = normalizePath(this.resourcePath)
|
||
|
|
const sourcePath = normalizePath(src)
|
||
|
|
if (resourcePath.indexOf(sourcePath) === 0) {
|
||
|
|
return ''
|
||
|
|
}
|
||
|
|
return content
|
||
|
|
}
|