8000 Swc-loader seems to ignore .swcrc.json and/or there's no way to specify a config · Issue #56 · swc-project/swc-loader · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
This repository was archived by the owner on Jul 14, 2023. It is now read-only.

Swc-loader seems to ignore .swcrc.json and/or there's no way to specify a config #56

Open
ghost opened this issue Jul 2, 2022 · 2 comments

Comments

@ghost
Copy link
ghost commented Jul 2, 2022

When I normally use SWC I call my config .swcrc.json to keep it consistent with tons of other similar configs and so that my IDE can automatically style the JSON, not being able to use .json is a pain.

When normally running swc I use --config-file .swcrc.json to specify the config, which works fine on most projects. However when using it with swc-loader and webpack, it seems that the config is completely ignored and instead defaults are used. However when calling it ".swcrc" only it seems to work, but I want it to be .json otherwise editing it in IDE looks ugly.

I also don't want to have to duplicate all the configuration to webpack, it's already in .swcrc.json, there shouldn't be any reason to duplicate it in there. Instead swc-loader should be able to read the existing config.

It would be nice if I could use swc-loader and keep my config named what I want it to be named.

sumbad and nwoltman reacted with thumbs up emoji
@alexgwolff
Copy link
alexgwolff commented Jul 20, 2022

Hi, you can do this:

const swcrc = await fs.readFile('swcrcPath', 'utf-8');

...


{
  test: /.(t|j)sx?/,
  exclude: /(node_modules)/,
  use: {
    loader: 'swc-loader',
    options: {
      ...JSON.parse(swcrc),
    },
  },
},

@busy-dog
Copy link
busy-dog commented May 1, 2023

I agree with swc-loader should be able to read the existing config, plz add this feature.

@swc-project swc-project temporarily blocked busy-dog May 1, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

2 participants
0