Skip to content

fix: remove unnecessary @swc-node/register from webpack commands#323

Open
saschabuehrle wants to merge 1 commit intojodit:mainfrom
saschabuehrle:fix/remove-unnecessary-swc-register
Open

fix: remove unnecessary @swc-node/register from webpack commands#323
saschabuehrle wants to merge 1 commit intojodit:mainfrom
saschabuehrle:fix/remove-unnecessary-swc-register

Conversation

@saschabuehrle
Copy link

Problem

The demo and build:react scripts were using node -r @swc-node/register to run webpack, which is unnecessary and causes issues:

  1. Webpack is already JavaScript - The webpack executable at ./node_modules/.bin/webpack is a pre-built JavaScript file that doesn't need TypeScript compilation
  2. Opens Node.js REPL - When node -r @swc-node/register runs without a filename, it opens the Node.js REPL instead of executing webpack
  3. Unproductive workflow - Users have to Ctrl+C twice to exit the REPL before scripts can complete

Solution

Removed the unnecessary node -r @swc-node/register wrapper from both scripts:

  • demo: Now uses webpack serve directly
  • build:react: Now uses webpack directly

The @swc-node/register loader is only needed when running TypeScript files directly with Node.js, not when executing pre-built JavaScript binaries.

Testing

Both scripts should now:

  • Execute webpack immediately without opening the Node.js REPL
  • Complete faster without requiring manual intervention
  • Maintain the same functionality (cross-env and webpack options preserved)

Fixes #299

Greetings, saschabuehrle

The demo and build:react scripts were using 'node -r @swc-node/register' to run webpack,
which is unnecessary since webpack is already a JavaScript file. This was causing the
node REPL to open instead of executing webpack properly.

The @swc-node/register loader is only needed when running TypeScript files directly
with Node.js, not when running pre-built JavaScript executables like webpack.

Fixes jodit#299
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

node -r swc-register command missing any filename - so it opens node REPL instead.

1 participant