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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: make terser an optional dependency #8049

Merged
merged 25 commits into from
Jun 8, 2022
Merged
Changes from 1 commit
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
de7f351
chore: make terser an optional dependency
sapphi-red May 6, 2022
cc697cf
chore(plugin-legacy): add terser to peer dep
sapphi-red May 20, 2022
faac5cd
chore: downgrade terser requirements to 5.4.0
sapphi-red May 20, 2022
715ca98
Merge branch 'main' into chore/terser-optional
sapphi-red May 20, 2022
e077d7e
chore: improve terser not found message
sapphi-red May 20, 2022
ecfc295
docs: use Terser instead of terser
sapphi-red May 21, 2022
caacc4e
chore: simplify terser not found message
sapphi-red May 21, 2022
18c1d59
Merge branch 'main' into chore/terser-optional
sapphi-red May 21, 2022
9278fc2
fix: terser import
sapphi-red May 21, 2022
ec34abf
docs: use Terser instead of terser
sapphi-red May 21, 2022
0b054fc
test: set `emptyOutDir: false` for flaky tests
sapphi-red May 21, 2022
f3d8450
chore(deps): bump vitest to 0.12.9 from 0.12.4
sapphi-red May 22, 2022
27e1c18
Merge branch 'main' into chore/terser-optional
sapphi-red May 22, 2022
925fd58
chore: use require inside worker
sapphi-red May 24, 2022
593df66
Merge branch 'main' into chore/terser-optional
sapphi-red May 24, 2022
eb0cc61
Revert "chore: use require inside worker"
sapphi-red May 24, 2022
706840f
Revert "Revert "chore: use require inside worker""
sapphi-red May 24, 2022
c8d2e2d
Merge branch 'main' into chore/terser-optional
sapphi-red May 27, 2022
80de213
chore: add comment about import inside worker
sapphi-red May 28, 2022
6385a9b
chore: add comment about emptyOutDir
sapphi-red May 28, 2022
d784dff
Merge branch 'main' into chore/terser-optional
sapphi-red May 31, 2022
d449ace
chore: add return type to requireResolveFromRootWithFallback
sapphi-red May 31, 2022
b6ec807
fix: use createRequire(root)
sapphi-red May 31, 2022
8e1d22b
Revert "fix: use createRequire(root)"
sapphi-red May 31, 2022
92113ec
Merge branch 'main' into chore/terser-optional
sapphi-red Jun 8, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix: use createRequire(root)
  • Loading branch information
sapphi-red committed May 31, 2022
commit b6ec807e863e0e27cb16846f995c8e3a5c48b9fd
12 changes: 6 additions & 6 deletions packages/vite/src/node/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -795,12 +795,12 @@ export const requireResolveFromRootWithFallback = (
root: string,
id: string
): string => {
// Search in the root directory first, and fallback to the default require paths.
const fallbackPaths = _require.resolve.paths?.(id) || []
const path = _require.resolve(id, {
paths: [root, ...fallbackPaths]
})
return path
// require in the root directory first, and fallback to the default require.
const _requireFromRoot = createRequire(path.resolve(root, './index.cjs'))
try {
return _requireFromRoot.resolve(id)
} catch {}
return _require.resolve(id)
}

// Based on node-graceful-fs
Expand Down