Describe the bug
When running SWC like this
npx swc src/app/v1/simple.js --out-file public/v1/output.js --watch
The first compile is a proper 1:1 copy of the .js file. However whenever I change anything in the source file and save it, the target file now contains the changes I made, but prepended with the original source file.
Note that working with --output-dir instead of --output-file does not have this problem.
Also normal compiles without --watch work fine.
Input code
npx swc src/app/v1/simple.js --out-file public/v1/simple.js --watch
Config
Link to the code that reproduces this issue
https://play.swc.rs/?version=1.11.29&code=H4sIAAAAAAAAA0vOzyvOz0nVy8lP11DySM3JyddRKM8vyklRVFTStAYAhtlSch4AAAA%3D&config=H4sIAAAAAAAAA6vmUlBQyipOVrJSqAYygZyCxKLi1CI4HyhSXJlXklgBFFFKTc5NLE4uyiwoUdKByWYVg6TSEnOKU8FCtVwgXAsAhP6ktVkAAAA%3D
SWC Info output
Operating System:
Platform: win32
Arch: x64
Machine Type: x86_64
Version: Windows 11 Home
CPU: (16 cores)
Models: AMD Ryzen 7 3700X 8-Core Processor
Binaries:
Node: 22.12.0
npm: N/A
Yarn: N/A
pnpm: N/A
Relevant Packages:
@swc/core: 1.11.29
@swc/helpers: 0.5.17
@swc/types: 0.1.21
typescript: 5.7.2
next: 15.2.4
SWC Config:
output: N/A
.swcrc path: N/A
Next.js info:
output: N/A
Expected behavior
A change in source files should not yield duplicate code in the output file.
Actual behavior
If source file simple.js is at first
console.log("Hello, world!!");
Then
npx swc src/app/v1/simple.js --out-file public/v1/output.js --watch
Results (properly) in output.js
console.log("Hello, world!!");
But after modifying simple.js (or even just hitting save without any modification)
console.log("Hello, world 2!!");
Output.js now is
console.log("Hello, world!!");
console.log("Hello, world 2!!");
Version
1.11.29
Additional context
No response
Describe the bug
When running SWC like this
The first compile is a proper 1:1 copy of the .js file. However whenever I change anything in the source file and save it, the target file now contains the changes I made, but prepended with the original source file.
Note that working with --output-dir instead of --output-file does not have this problem.
Also normal compiles without --watch work fine.
Input code
Config
{}Link to the code that reproduces this issue
https://play.swc.rs/?version=1.11.29&code=H4sIAAAAAAAAA0vOzyvOz0nVy8lP11DySM3JyddRKM8vyklRVFTStAYAhtlSch4AAAA%3D&config=H4sIAAAAAAAAA6vmUlBQyipOVrJSqAYygZyCxKLi1CI4HyhSXJlXklgBFFFKTc5NLE4uyiwoUdKByWYVg6TSEnOKU8FCtVwgXAsAhP6ktVkAAAA%3D
SWC Info output
Operating System:
Platform: win32
Arch: x64
Machine Type: x86_64
Version: Windows 11 Home
CPU: (16 cores)
Models: AMD Ryzen 7 3700X 8-Core Processor
Expected behavior
A change in source files should not yield duplicate code in the output file.
Actual behavior
If source file simple.js is at first
Then
Results (properly) in output.js
But after modifying simple.js (or even just hitting save without any modification)
Output.js now is
Version
1.11.29
Additional context
No response