Improve review-tool performance.
This commit is contained in:
@@ -13,6 +13,21 @@ const apiTarget = `http://127.0.0.1:${apiPort}`;
|
||||
export default defineConfig({
|
||||
plugins: [react()],
|
||||
|
||||
resolve: {
|
||||
// The syntax highlighter runs in a worker (see src/lib/highlight.ts), and one
|
||||
// package deep under refractor — decode-named-character-reference, pulled in
|
||||
// by the markup language to decode HTML entities — ships a browser build
|
||||
// that calls `document.createElement` at module scope. A worker has no
|
||||
// document, so importing refractor there threw before a line was highlighted.
|
||||
//
|
||||
// The package publishes a document-free build for exactly this case and
|
||||
// lists it first in its export map, under `worker`. Asking for that
|
||||
// condition is what picks it up. It resolves for the main bundle too, which
|
||||
// is what we want: it is the same function with a lookup table in place of
|
||||
// the DOM's entity parser, and one implementation beats two.
|
||||
conditions: ['worker'],
|
||||
},
|
||||
|
||||
// Relative asset URLs, because the page is served from a tab's path
|
||||
// (`/t/tab3/`) and not from the server root. With an absolute base the
|
||||
// browser would ask for `/assets/app.js` and get the tab router instead.
|
||||
|
||||
Reference in New Issue
Block a user