Skip to content

Commit

Permalink
test: set relativeUrls = true and disable rebaseUrls in less processor
Browse files Browse the repository at this point in the history
  • Loading branch information
sinoon committed Mar 5, 2022
1 parent 86cda8b commit daf6874
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions packages/vite/src/node/plugins/css.ts
Expand Up @@ -659,6 +659,10 @@ async function compileCSS(
// important: set this for relative import resolving
opts.filename = cleanUrl(id)

if (lang === 'less') {
opts.relativeUrls = true
}

const preprocessResult = await preProcessor(
code,
config.root,
Expand Down Expand Up @@ -1286,13 +1290,7 @@ function createViteLessPlugin(
path.join(dir, '*')
)
if (resolved) {
const result = await rebaseUrls(resolved, this.rootFile, this.alias)
let contents: string
if (result && 'contents' in result) {
contents = result.contents
} else {
contents = fs.readFileSync(resolved, 'utf-8')
}
const contents = fs.readFileSync(resolved, 'utf-8')
return {
filename: path.resolve(resolved),
contents
Expand Down

0 comments on commit daf6874

Please sign in to comment.