PERF010 · Namespace import
Severity: info · Category: performance
What it checks
Section titled “What it checks”Flags a value import * as X from '<package>' from a bare (node_modules) package. Type-only imports (import type * as T) and non-bare specifiers (relative, $lib, $app, $env, #…) are not flagged. Static (CLI) analysis of src/**/*.svelte scripts.
Why it matters
Section titled “Why it matters”A namespace import (import * as X) is only tree-shakeable while every access to X stays static (X.foo()); passing X around or indexing it dynamically (X[key]) forces the bundler to assume every export is reachable and keep the whole module. Named imports are reliably shakeable and make the dependency surface explicit — even packages like three or d3 ship less when imported by name.
How to fix
Section titled “How to fix”<script> // Instead of: import * as _ from 'lodash'; import debounce from 'lodash/debounce';
// Instead of: import * as THREE from 'three'; import { Scene, WebGLRenderer } from 'three';</script>