Skip to content
This repository was archived by the owner on Aug 16, 2022. It is now read-only.

feat: source map cache busting option #48

Merged
merged 1 commit into from
Jan 13, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions src/parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,19 @@ const splitRE = /\r?\n/g
const emptyRE = /^(?:\/\/)?\s*$/

const Config = struct({
needMap: 'boolean?'
needMap: 'boolean?',
bustCache: 'boolean?'
}, {
needMap: true
needMap: true,
bustCache: false
})

module.exports = function (content, filename, config) {
assertType({ content, filename }, 'string')
config = Config(config)

const cacheKey = hash(filename + content)
const filenameWithHash = filename + '?' + cacheKey // source-map cache busting for hot-reloadded modules
const filenameWithHash = config.bustCache ? filename + '?' + cacheKey : filename // source-map cache busting for hot-reloadded modules

if (cache.has(cacheKey)) return cache.get(cacheKey)

Expand Down