You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I run the command npx swc ./src/index.js -o ./dist/output.js --watch the output.js file contains the output as expected on the first compilation.
When I alter index.js and then save, the watch mode triggers a re-compile. This time, the file contains the output from the first compile, and the output from the altered file.
If I remove the relative paths and instead do this: npx swc src/index.js -o dist/output.js --watch the output contains only the current altered file's compilation as expected.
Note: I used directories here but the behaviour is the same if you are just compiling and outputting at the root level i.e. npx swc ./index.js -o ./output.js --watch
Expected Behaviour
--watch mode does not include any previous compilations and only includes compiled output from the current file save even when using relative paths in command.
index.js:
console.log('Speedy Web Compiler');
output.js:
console.log('Speedy Web Compiler');
Updated index.js and Save:
console.log('Speedy Web Compiler is speedy');
Updated output.js:
console.log('Speedy Web Compiler is speedy');
Actual Behaviour
--watch mode includes first compiled output in output.js when relative paths are used in the command.
index.js:
console.log('Speedy Web Compiler');
output.js:
console.log('Speedy Web Compiler');
Updated index.js and Save:
console.log('Speedy Web Compiler is speedy');
Updated output.js:
console.log('Speedy Web Compiler');console.log('Speedy Web Compiler is speedy');
This is confusing because the documentation uses relative paths in the usage section so I would expect that they would work everywhere.
Describe the bug
When I run the command
npx swc ./src/index.js -o ./dist/output.js --watch
theoutput.js
file contains the output as expected on the first compilation.When I alter
index.js
and then save, the watch mode triggers a re-compile. This time, the file contains the output from the first compile, and the output from the altered file.If I remove the relative paths and instead do this:
npx swc src/index.js -o dist/output.js --watch
the output contains only the current altered file's compilation as expected.Note: I used directories here but the behaviour is the same if you are just compiling and outputting at the root level i.e.
npx swc ./index.js -o ./output.js --watch
Expected Behaviour
--watch
mode does not include any previous compilations and only includes compiled output from the current file save even when using relative paths in command.index.js:
output.js:
Updated index.js and Save:
Updated output.js:
Actual Behaviour
--watch
mode includes first compiled output inoutput.js
when relative paths are used in the command.index.js:
output.js:
Updated index.js and Save:
Updated output.js:
This is confusing because the documentation uses relative paths in the usage section so I would expect that they would work everywhere.
see: https://swc.rs/docs/usage/cli#usage
May be related to #99 but I thought the extra detail may be helpful for context.
The text was updated successfully, but these errors were encountered: