提交 c007fe6b 编写于 作者: fxy060608's avatar fxy060608

fix(nvue): add file-loader

上级 d717f1d0
const path = require('path')
const isWin = /^win/.test(process.platform)
const normalizePath = path => (isWin ? path.replace(/\\/g, '/') : path)
module.exports = {
loader: 'file-loader',
options: {
publicPath (url, resourcePath, context) {
return '/' + normalizePath(path.relative(process.env.UNI_INPUT_DIR, resourcePath))
},
outputPath (url, resourcePath, context) {
return normalizePath(path.relative(process.env.UNI_INPUT_DIR, resourcePath))
}
}
}
const path = require('path')
const isWin = /^win/.test(process.platform)
const normalizePath = path => (isWin ? path.replace(/\\/g, '/') : path)
const fileLoader = require('./file-loader.js')
const defaultOptions = {
limit: -1,
fallback: {
loader: 'file-loader',
options: {
publicPath (url, resourcePath, context) {
return '/' + normalizePath(path.relative(process.env.UNI_INPUT_DIR, resourcePath))
},
outputPath (url, resourcePath, context) {
return normalizePath(path.relative(process.env.UNI_INPUT_DIR, resourcePath))
}
}
}
fallback: fileLoader
}
const inlineLimit =
......@@ -60,4 +46,4 @@ module.exports = {
}
},
rewriteUrl
}
}
......@@ -11,7 +11,7 @@ const {
nvueHtmlPreprocessOptions,
getTemplatePath
} = require('@dcloudio/uni-cli-shared')
const fileLoader = require('@dcloudio/uni-cli-shared/lib/file-loader')
const WebpackAppPlusNVuePlugin = process.env.UNI_USING_V3
? require('../packages/webpack-app-plus-plugin')
: require('../packages/webpack-app-plus-nvue-plugin')
......@@ -109,13 +109,7 @@ if (process.env.NODE_ENV === 'development') {
const rules = [{
test: /\.(png|jpg|gif|ttf|eot|woff|woff2)$/i,
use: [{
loader: 'file-loader',
options: {
publicPath: 'assets',
outputPath: 'assets'
}
}]
use: [fileLoader]
}, {
test: path.resolve(process.env.UNI_INPUT_DIR, 'pages.json'),
use: [{
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册