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

Commit 93b6847

Browse files
authored
feat: source map cache busting option (#48)
fixes #46
1 parent 63b91f7 commit 93b6847

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/parser.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,19 @@ const splitRE = /\r?\n/g
1111
const emptyRE = /^(?:\/\/)?\s*$/
1212

1313
const Config = struct({
14-
needMap: 'boolean?'
14+
needMap: 'boolean?',
15+
bustCache: 'boolean?'
1516
}, {
16-
needMap: true
17+
needMap: true,
18+
bustCache: false
1719
})
1820

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

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

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

0 commit comments

Comments
 (0)