0
# @swc/core-linux-arm64-musl
1
2
`@swc/core-linux-arm64-musl` is a platform-specific native binary package that provides optimized native performance for the SWC compiler on Linux ARM64 systems using musl libc. This package contains no JavaScript API - it serves solely as a distribution mechanism for the compiled native binary.
3
4
## Package Information
5
6
- **Package Name**: @swc/core-linux-arm64-musl
7
- **Package Type**: npm
8
- **Language**: Native Binary (Rust-compiled)
9
- **Installation**: Automatically installed as optional dependency with `@swc/core`
10
- **Target Platform**: Linux ARM64 with musl libc (aarch64-unknown-linux-musl)
11
12
## Overview
13
14
This package is part of SWC's multi-platform distribution strategy. SWC (Speedy Web Compiler) is a super-fast TypeScript and JavaScript compiler written in Rust that serves as a high-performance alternative to Babel. Rather than providing a single large binary, SWC distributes platform-specific native binaries as separate optional dependencies to optimize installation size and performance.
15
16
## Core Imports
17
18
**Important**: This package provides no JavaScript API and should never be imported directly. It contains only native binary files.
19
20
```javascript
21
// INCORRECT - This package cannot be imported
22
import anything from "@swc/core-linux-arm64-musl"; // ❌ Will fail - no exports
23
24
// CORRECT - Use @swc/core instead
25
import { transform, minify, parse } from "@swc/core"; // ✅ Correct approach
26
```
27
28
## Basic Usage
29
30
This package is used automatically by `@swc/core` and requires no direct interaction:
31
32
```bash
33
# Install @swc/core (this package gets installed automatically if needed)
34
npm install @swc/core
35
36
# Use SWC through @swc/core - the native binary from this package runs behind the scenes
37
npx swc ./src --out-dir ./dist
38
```
39
40
## Installation
41
42
**Important**: This package should never be installed directly. It is automatically installed as an optional dependency when you install `@swc/core` on a compatible Linux ARM64 musl system.
43
44
```bash
45
# Correct way - install @swc/core
46
npm install @swc/core
47
# @swc/core-linux-arm64-musl gets installed automatically on compatible systems
48
49
# Incorrect - do not install directly
50
npm install @swc/core-linux-arm64-musl # Don't do this
51
```
52
53
## Architecture
54
55
This package is part of SWC's multi-platform binary distribution strategy. When `@swc/core` is installed:
56
57
1. **Platform Detection**: npm automatically determines if the current system matches the platform constraints (Linux + ARM64 + musl)
58
2. **Optional Installation**: If compatible, this package is installed as an optional dependency
59
3. **Runtime Loading**: `@swc/core` loads the appropriate binary at runtime through its binding mechanism
60
4. **Fallback Strategy**: If the native binary fails to load, `@swc/core` falls back to the WebAssembly version
61
62
## Capabilities
63
64
### Native Binary Distribution
65
66
Provides platform-specific native binaries optimized for Linux ARM64 musl systems.
67
68
```json { .api }
69
{
70
"main": "swc.linux-arm64-musl.node",
71
"files": [
72
"swc.linux-arm64-musl.node",
73
"swc"
74
]
75
}
76
```
77
78
### Platform Constraints
79
80
Defines the specific platform requirements for automatic installation.
81
82
```json { .api }
83
{
84
"os": ["linux"],
85
"cpu": ["arm64"],
86
"libc": ["musl"],
87
"engines": {
88
"node": ">=10"
89
}
90
}
91
```
92
93
### Integration with @swc/core
94
95
This package has no direct JavaScript API. All SWC functionality is accessed through the `@swc/core` package, which automatically loads this binary when running on compatible systems.
96
97
```javascript
98
// This package provides the native binary that powers these @swc/core functions
99
import { transform, minify, parse } from "@swc/core";
100
101
// When running on Linux ARM64 musl, @swc/core automatically uses
102
// the swc.linux-arm64-musl.node binary from this package
103
const result = await transform(code, options);
104
```
105
106
### Performance Benefits
107
108
Using this native binary instead of WebAssembly provides:
109
110
- **Faster compilation**: Direct native execution without WebAssembly overhead
111
- **Lower memory usage**: More efficient memory management in native code
112
- **Better performance**: Optimized for the specific target architecture
113
114
## Troubleshooting
115
116
### Binary Loading Issues
117
118
If the native binary fails to load:
119
120
1. **Automatic Fallback**: `@swc/core` will automatically attempt to install and use `@swc/wasm` as a fallback
121
2. **Manual Override**: Set `SWC_BINARY_PATH` environment variable to specify a custom binary location
122
3. **Compatibility Check**: Verify your system matches the platform constraints (Linux ARM64 musl)
123
124
### Common Issues
125
126
- **Architecture Mismatch**: This package only works on ARM64 systems, not x86_64
127
- **libc Compatibility**: Requires musl libc, not glibc (use `@swc/core-linux-arm64-gnu` for glibc systems)
128
- **Missing Binary**: If the package installed but binary is missing, try reinstalling `@swc/core`
129
130
## Related Packages
131
132
This package is part of SWC's platform-specific binary ecosystem:
133
134
- **@swc/core**: Main package that provides the JavaScript API
135
- **@swc/core-linux-x64-gnu**: x86_64 Linux with glibc
136
- **@swc/core-linux-x64-musl**: x86_64 Linux with musl
137
- **@swc/core-linux-arm64-gnu**: ARM64 Linux with glibc (this package's glibc counterpart)
138
- **@swc/core-darwin-arm64**: macOS ARM64
139
- **@swc/core-darwin-x64**: macOS x86_64
140
- **@swc/core-win32**: Windows binaries
141
- **@swc/wasm**: WebAssembly fallback
142
143
## Summary
144
145
`@swc/core-linux-arm64-musl` is a pure distribution package containing native binaries with no JavaScript API. It exists to provide optimal native performance for SWC on Linux ARM64 musl systems. Users interact with SWC functionality exclusively through the `@swc/core` package, which automatically handles loading the appropriate platform-specific binary from packages like this one.