mirror of
https://github.com/alrayyes/wiki.git
synced 2025-05-11 03:04:21 +00:00
reverse query param hack to re-add sourcemap support
This commit is contained in:
parent
1da467d214
commit
a0d651d64d
4 changed files with 33 additions and 3 deletions
|
@ -298,14 +298,15 @@ See the [documentation](https://quartz.jzhao.xyz) for how to get started.
|
|||
outfile: path.join("quartz", cacheFile),
|
||||
bundle: true,
|
||||
keepNames: true,
|
||||
minify: true,
|
||||
minifyWhitespace: true,
|
||||
minifySyntax: true,
|
||||
platform: "node",
|
||||
format: "esm",
|
||||
jsx: "automatic",
|
||||
jsxImportSource: "preact",
|
||||
packages: "external",
|
||||
metafile: true,
|
||||
sourcemap: "inline",
|
||||
sourcemap: true,
|
||||
sourcesContent: false,
|
||||
plugins: [
|
||||
sassPlugin({
|
||||
|
@ -374,6 +375,7 @@ See the [documentation](https://quartz.jzhao.xyz) for how to get started.
|
|||
}
|
||||
|
||||
// bypass module cache
|
||||
// https://github.com/nodejs/modules/issues/307
|
||||
const { default: buildQuartz } = await import(cacheFile + `?update=${randomUUID()}`)
|
||||
await buildQuartz(argv, clientRefresh)
|
||||
clientRefresh()
|
||||
|
|
|
@ -1,4 +1,19 @@
|
|||
import "source-map-support/register.js"
|
||||
import sourceMapSupport from "source-map-support"
|
||||
sourceMapSupport.install({
|
||||
retrieveSourceMap(source) {
|
||||
// source map hack to get around query param
|
||||
// import cache busting
|
||||
if (source.includes(".quartz-cache")) {
|
||||
let realSource = fileURLToPath(source.split("?", 2)[0] + '.map')
|
||||
return {
|
||||
map: fs.readFileSync(realSource, 'utf8')
|
||||
}
|
||||
} else {
|
||||
return null
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
import path from "path"
|
||||
import { PerfTimer } from "./perf"
|
||||
import { rimraf } from "rimraf"
|
||||
|
@ -14,6 +29,8 @@ import { ProcessedContent } from "./plugins/vfile"
|
|||
import { Argv, BuildCtx } from "./ctx"
|
||||
import { glob, toPosixPath } from "./glob"
|
||||
import { trace } from "./trace"
|
||||
import { fileURLToPath } from "url"
|
||||
import fs from "fs"
|
||||
|
||||
async function buildQuartz(argv: Argv, clientRefresh: () => void) {
|
||||
const ctx: BuildCtx = {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue