Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Webpack - Module build failed when bundling `swc-loader`

I am working on a Webpack tool that can build itself. I am able to build the tool the first time but when I try to rebuild it a second time I get the error Cannot find module: swc-loader. The same issue exists when swapping swc-loader with babel-loader. My hunch is that this is related to webpack's resolveLoader

Here is a GitHub repository containing the tool.

Below are the steps to reproduce the issue:

  1. Bundle the src directory by running node src/index.js
  2. Bundle the src directory again by running node dist/index.js

The goal is to be able to run step 2 over and over again.

like image 349
woodpav Avatar asked Oct 25 '25 05:10

woodpav


1 Answers

swc-loader is not included in the core lib and needs to be installed via package manager - yarn install --dev swc-loader

like image 163
Yashank Avatar answered Oct 27 '25 00:10

Yashank