This repository has been archived by the owner on Jul 14, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 29
Error when using options array for multiple parser configurations #22
Comments
hogarthww-labs
changed the title
Error when using options array
Error when using options array for multiple parser configurations
Aug 20, 2021
@hogarthww-labs For the time being you can import swcrc config to your webpack config and do the extension import swcJSConfig from "./.swcrc.mjs";
import swcTSConfig from "./.swcrc.ts.mjs";
...
rules: [
{
test: /\.m?jsx?$/,
exclude: /node_modules/,
use: [
{
loader: "swc-loader",
options: swcJSConfig,
}
]
},
{
test: /\.tsx?$/,
exclude: /node_modules/,
use: [
{
loader: "swc-loader",
options: swcTSConfig,
}
]
},
]
... Hope this helps, as it helped me resolve the issue on my end. |
Since TypeScript is a superset of JavaScript (i.e. all JavaScript is valid TypeScript), you may also be able to just use your TypeScript config. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
As per: https://swc.rs/docs/configuring-swc/#multiple-entries
We've been trying to use the following swc configuration options:
We've tried adding this to a
.swrc
file in the app folder for the app being build and in the root of our Nx monorepo (same folder as ourwebpack.config.js
). Not sure if it is picked up correctly. Then when we tried setting these options directly in the webpack rule with the loader:We get the following error:
Complaining that options must be an object or string. What should we do?
The Webpack rule for
swc-loader
when we print it:We need SWC to transpile ts and tsx files as typescript files and js and jsx files as ecmascript files. We are currently transitioning from Javascript to Typescript and have a mix.
The text was updated successfully, but these errors were encountered: