Skip to content

Commit

Permalink
fix(mp-baidu): normalize asset file (question/154595)
Browse files Browse the repository at this point in the history
  • Loading branch information
fxy060608 committed Oct 8, 2022
1 parent a1fbbd2 commit 81acc66
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions packages/uni-cli-shared/lib/file-loader.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
const path = require('path')

const isWin = /^win/.test(process.platform)

const normalizePath = path => (isWin ? path.replace(/\\/g, '/') : path)
const {
normalizeNodeModules
} = require('./util')

module.exports = {
loader: 'file-loader',
options: {
publicPath (url, resourcePath, context) {
return '/' + normalizePath(path.relative(process.env.UNI_INPUT_DIR, resourcePath))
return '/' + normalizeNodeModules(path.relative(process.env.UNI_INPUT_DIR, resourcePath))
},
outputPath (url, resourcePath, context) {
return normalizePath(path.relative(process.env.UNI_INPUT_DIR, resourcePath))
return normalizeNodeModules(path.relative(process.env.UNI_INPUT_DIR, resourcePath))
}
}
}

0 comments on commit 81acc66

Please sign in to comment.