From 81acc665b922f6a0721b918073e654fd84d55920 Mon Sep 17 00:00:00 2001 From: fxy060608 Date: Sat, 8 Oct 2022 15:41:22 +0800 Subject: [PATCH] fix(mp-baidu): normalize asset file (question/154595) --- packages/uni-cli-shared/lib/file-loader.js | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/packages/uni-cli-shared/lib/file-loader.js b/packages/uni-cli-shared/lib/file-loader.js index 0bc89f57b..c2cdced40 100644 --- a/packages/uni-cli-shared/lib/file-loader.js +++ b/packages/uni-cli-shared/lib/file-loader.js @@ -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)) } } } -- GitLab