Skip to content

Commit

Permalink
docs: clarify code comments in optimize-missing-deps
Browse files Browse the repository at this point in the history
  • Loading branch information
benmccann authored Mar 15, 2022
1 parent 65aaeee commit 38f3f44
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/playground/optimize-missing-deps/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,11 @@ async function createServer(root = process.cwd()) {
let template = fs.readFileSync(resolve('index.html'), 'utf-8')
template = await vite.transformIndexHtml(req.originalUrl, template)

// this will import missing deps nest built-in deps that should not be optimized
// dependencies aren't discovered until `./main.js` is parsed and scanned, so they are "missing"
// this will import "missing" deps that are not yet discovered, but will not optimize them
const { name } = await vite.ssrLoadModule('./main.js')

// this will import missing deps that should be optimized correctly
// this will import "missing" deps in such a manner that they will be optimized
const appHtml = `<div id="app">${name}</div>
<script type='module'>
import { name } from './main.js'
Expand Down

0 comments on commit 38f3f44

Please sign in to comment.