Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: correctly ignore optional deps when bundling vite deps #4223

Merged
merged 1 commit into from Jul 12, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
28 changes: 2 additions & 26 deletions packages/vite/rollup.config.js
Expand Up @@ -161,14 +161,10 @@ const createNodeConfig = (isProduction) => {
replacement: `: eval('require'),`
}
}),
// Optional peer deps of ws. Native deps that are mostly for performance.
// Since ws is not that perf critical for us, just ignore these deps.
ignoreDepPlugin({
bufferutil: 1,
'utf-8-validate': 1
}),
commonjs({
extensions: ['.js'],
// Optional peer deps of ws. Native deps that are mostly for performance.
// Since ws is not that perf critical for us, just ignore these deps.
ignore: ['bufferutil', 'utf-8-validate']
}),
json(),
Expand Down Expand Up @@ -261,26 +257,6 @@ function shimDepsPlugin(deps) {
}
}

/**
* @type { (deps: Record<string, any>) => import('rollup').Plugin }
*/
function ignoreDepPlugin(ignoredDeps) {
return {
name: 'ignore-deps',
resolveId(id) {
if (id in ignoredDeps) {
return id
}
},
load(id) {
if (id in ignoredDeps) {
console.log(`ignored: ${id}`)
return ''
}
}
}
}

function licensePlugin() {
return license({
thirdParty(dependencies) {
Expand Down