Skip to content

Commit

Permalink
fix: avoid absolute path in cache-loader inline options
Browse files Browse the repository at this point in the history
close #1367
  • Loading branch information
yyx990803 committed Aug 7, 2018
1 parent 37ee677 commit c6ab50a
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lib/loaders/pitcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,15 @@ module.exports.pitch = function (remainingRequest) {

// for templates: inject the template compiler & optional cache
if (query.type === `template`) {
const path = require('path')
const cacheLoader = cacheDirectory && cacheIdentifier
? [`cache-loader?${JSON.stringify({
cacheDirectory,
// For some reason, webpack fails to generate consistent hash if we
// use absolute paths here, even though the path is only used in a
// comment. For now we have to ensure cacheDirectory is a relative path.
cacheDirectory: path.isAbsolute(cacheDirectory)
? path.relative(process.cwd(), cacheDirectory)
: cacheDirectory,
cacheIdentifier: hash(cacheIdentifier) + '-vue-loader-template'
})}`]
: []
Expand Down

0 comments on commit c6ab50a

Please sign in to comment.