Skip to content

Commit 2c11352

Browse files
committed
fix: add transformUrl for Quasar components #44
1 parent 4c52c92 commit 2c11352

File tree

2 files changed

+26
-1
lines changed

2 files changed

+26
-1
lines changed

index.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
const fs = require('fs')
22
const path = require('path')
33
const webpack = require('webpack')
4+
const { merge } = require('webpack-merge')
45

56
const getDevlandFile = require('./lib/get-devland-file')
67
const { version } = getDevlandFile('quasar/package.json')
78

9+
const transformAssetUrls = getDevlandFile('quasar/dist/transforms/loader-asset-urls.json')
10+
811
function getCssPreprocessor (api) {
912
return ['sass', 'scss', 'styl'].find(ext => {
1013
return fs.existsSync(
@@ -53,6 +56,25 @@ module.exports = (api, options) => {
5356

5457
const strategy = options.pluginOptions.quasar.importStrategy || 'kebab'
5558

59+
chain.module.rule('vue').use('vue-loader').tap(options => ({
60+
...options,
61+
transformAssetUrls: merge(
62+
{
63+
base: null,
64+
includeAbsolute: false,
65+
tags: {
66+
video: ['src', 'poster'],
67+
source: ['src'],
68+
img: ['src'],
69+
image: ['xlink:href', 'href'],
70+
use: ['xlink:href', 'href']
71+
}
72+
},
73+
options.transformAssetUrls || {},
74+
transformAssetUrls
75+
)
76+
}))
77+
5678
if (['kebab', 'pascal', 'combined'].includes(strategy)) {
5779
chain.module.rule('vue')
5880
.use('vue-auto-import-quasar')

package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,8 @@
2121
"bugs": {
2222
"url": "https://github.com/quasarframework/vue-cli-plugin-quasar/issues"
2323
},
24-
"homepage": "https://github.com/quasarframework/vue-cli-plugin-quasar#readme"
24+
"homepage": "https://github.com/quasarframework/vue-cli-plugin-quasar#readme",
25+
"dependencies": {
26+
"webpack-merge": "^5.7.3"
27+
}
2528
}

0 commit comments

Comments
 (0)