Skip to main content

Questions tagged [swc]

An Adobe SWC file is a package of precompiled Flash symbols and ActionScript code that allows a Flash or Flex developer to distribute classes and assets, or to avoid recompiling symbols and code that will not change. Please, do not use this tag for questions related to the SWC JavaScript compiler (use [swc-compiler] instead).

0 votes
1 answer
20 views

Replace a TaggedTemplateExpression with a CallExpression in a SWC Rust Plugin

I'm working on a SWC Rust WASM plugin to transform JavaScript. Overall SWC and its API are well designed. However currently I struggle to convert a TaggedTemplateExpression to a CallExpression like in ...
jantimon's user avatar
  • 37.7k
0 votes
0 answers
22 views

How do I pass parameters to the swc-plugin

I want to pass parameters to a custom swc-plugin to dynamically replace the value of a variable. How do I do this? const swc = require("@swc/core"); const fs = require("fs"); ...
yyy chen's user avatar
0 votes
1 answer
58 views

Injecting Comments with a SWC Rust plugin

I am trying to inject a comment to existing javascript code. In Babel there is the addComment helper which can be called on a AST node. Here is a simple (but rather silly) transformation written in ...
jantimon's user avatar
  • 37.7k
0 votes
0 answers
25 views

Vite compiled file fails with error during namespace mapping

I have a node.js app that I want to build with Vite/SWC. Config file: import { defineConfig } from 'vite'; import { VitePluginNode } from 'vite-plugin-node'; import path from 'path'; export default ...
Vololodymyr's user avatar
  • 2,178
0 votes
0 answers
28 views

Next.JS 13+ and IE11

How can I make Next.JS 13 application to be compatible with IE11. it uses SWC and I'm not sure how to fix SCRIPT1010: Expected identifier and SCRIPT1002: Syntax error errors
A.A's user avatar
  • 3,768
2 votes
0 answers
184 views

building nestjs app with SWC inside an nx-based monorepo does not bundle /libs source code but references imports instead?

I'm trying to find out how to configure SWC in a way that builds the applications inside my monorepo with the source code from my libs directory, like I used to do with webpack (although much much ...
SebastianG's user avatar
  • 9,247
0 votes
1 answer
164 views

NestJs dependency injection in constructor is undefined with class-based provider but works with token provider

I am trying to get NestJs dependency injection to work without needing a provider 'token'. For a simple example, this setup works: @Injectable() export class AClass { constructor() { console.log(...
okhobb's user avatar
  • 849
0 votes
1 answer
283 views

Migrate from Babel to Nextjs SWC encountering Minified React error

When I removed my current .babelrc in order to force NextJS 13 using SWC instead. It's showing the error: Error: Minified React error #130. But when I add the .babelrc file again everything worked ...
Ted Vu's user avatar
  • 99
1 vote
1 answer
129 views

Instagram-like CSS class names obfuscation for NextJS 14 with SWC

I noticed that Instagram Direct often use Tailwind CSS for class names. But somehow they managed to transform it to non-readable format (obfuscation), so people could not run bots for content crawling....
Grisaia's user avatar
  • 65
2 votes
0 answers
323 views

Why is Next.js trying to load @next/swc-linux-arm64-gnu despite .babelrc being present?

I am getting the error logs when trying to load a page in dev environment: 2024-03-11 17:17:06 yarn run v1.22.19 2024-03-11 17:17:06 $ next dev -p 4000 2024-03-11 17:17:10 Disabled SWC as ...
Flip's user avatar
  • 6,581
0 votes
2 answers
285 views

swc-loader not showing typescript errors in console

I'm switching from ts-loader to swc-loader following this bloq. However, after migrating, it fails to show me the most basic Typescript errors in the console. For example, I have the following line ...
Genarito's user avatar
  • 3,303
0 votes
0 answers
59 views

Cargo install swc_cli not working with error

Here is the Rust version % cargo --version cargo 1.75.0 (1d8b05cdd 2023-11-20) When I use cargo to install swc_cli cargo install swc_cli Cargo install swc_cli not working with the following error: ...
yyy chen's user avatar
0 votes
0 answers
258 views

After installing SWC in NestJS with Typescript ttshivers/automapper is not mapping

I'm developing a Nest.js and I use different packages such as @ttshivers/automapper to map between entities and dtos. Since decorating class members with @Automap() is verbose, I followed the steps in ...
Aldemar Cuartas Carvajal's user avatar
0 votes
1 answer
1k views

Failed to Load SWC Binary Error in Next.js Development Server

I encountered an issue while running my Next.js project using the yarn run dev command. The error message is as follows in the image Error Details: Next.js Version: 14.0.3 Local Server: http://...
Awais Ahmad's user avatar
0 votes
1 answer
356 views

How to resolve path error in compilation?

I have nest config - nestjs 10, prisma 5.6.0, swc schema.prisma file generator client { provider = "prisma-client-js" output = "../generated/client" ...
Aslero's user avatar
  • 1
3 votes
0 answers
459 views

Make Next.js 13 application run in old browser like Chrome 33

I need to create a Next.js application which uses Next 14+ that runs on a Chrome 33 browser which is supposed to support ES5 only. Given that some packages inside Next dependency like (@next/font) ...
Josué Barillas's user avatar
0 votes
0 answers
403 views

Issue with Transpiling Packages in a Turborepo Project with Nest + SWC + pnpm (SyntaxError: Unexpected token 'export')

I'm trying to create an internal package in my turborepo project that uses pnpm as the package manager. The shared package follows the exact same setup as provided in the turborepo documentation, and ...
Cytronic's user avatar
  • 201
3 votes
0 answers
233 views

Expression expected in index.js after switching to swc-loader

i have to change loader in my webpack.config to swc-loader and i'm using react-app-rewired, i have added the following code to config-overrides.js : module.exports = function override(config, env) { ...
Albert Albatros's user avatar
0 votes
0 answers
38 views

Cannot find module '../../../../lib/esm/index.js'

In file /atoms/overlays/Sheet/styles I do import {maxHeight} from '.' And causing the following error Error: Cannot find module '../../../../lib/esm/index.js' Require stack: - /Users/x/Desktop/project/...
Ahmad M. Hawwash's user avatar
1 vote
0 answers
390 views

How Next.js support ESM and the building process?

Next.js 12 supports native ESM support. I would like to understand how Next.js supports ESM and the bundling process. The research process has not been smooth, so I would appreciate it if you could ...
Paul Wang's user avatar
  • 276
1 vote
1 answer
3k views

Nest JS and Typescript with SWC is not compiling dist folder correctly

Hi all I'm getting this error. I have surf through all the internet but haven't found any useful solution and even the GitHub discussion was not even useful for me on this topic below are the some ...
Aneeq Khurram's user avatar
-2 votes
2 answers
571 views

How to override the CSS default properties of Material UI on React? [closed]

I have some React project and I'm using the 'Table' component from Maerial UI. That table with her components (TableHead, TableCell, TableRow etc.) have thier default CSS properties. But when I'm ...
Noam Cohen's user avatar
4 votes
2 answers
1k views

Turborepo internal package WITHOUT Next.js

I'm trying to create an internal package in a turborepo project. The shared package follows the same setup as the example, and it works as is in the Vite frontend project. However, when importing that ...
Laci556's user avatar
  • 152
0 votes
0 answers
61 views

Nightwatch SWC core error when running a test

After using the Nightwatch installer to add Nightwatch to my existing folder, I encountered an error while running the sample tests. I tried uninstalling and reinstalling 'swc' and even updated it to ...
Aaisha Zaman's user avatar
0 votes
0 answers
16 views

how can i resolve the native binary dependence in VS Code plugin development , such as swc and esbuid

I'm writting a VS Code plugin. Some command is compile the code and bundle js. I use esbuid and swc in my case. I'm not sure that if should I bundle the native dependences in my plugin,or put them as ...
杨永安's user avatar
7 votes
4 answers
3k views

nestjs swc Error: Cannot find module 'path-to-project/src/app.module'

When I installed the swc, I get this Error: Cannot find module 'path-to-project/src/app.module' I'm using: nodejs: 18.17.1 nestjs: 10.1.16 @swc/cli: 0.1.62 @swc/core: 1.3.81 "dist/main.js" ...
krokodaws's user avatar
0 votes
0 answers
134 views

Combining Babel Library in SWC Next.js: Integrate external Babel-dependent package while preserving SWC compilation

In my Next.js project, the primary compiler is SWC. However, I have a component that relies on an external library compiled with Babel. Is it feasible to configure Next.js to use Babel exclusively for ...
Rodolfo Campos's user avatar
3 votes
0 answers
914 views

SWC is not adding extension on imports

I'm working with SWC compiler for the first time in a project. I'm using it to compile my typescript files in /src to javascript files in /dist. The structure of the project is something like this: | -...
Salvador Bacci's user avatar
0 votes
0 answers
31 views

Vercel not deploying

ERR! code EBADPLATFORM npm ERR! notsup Unsupported platform for @next/[email protected]: wanted {"os":"win32","arch":"x64"} (current: {"os":&...
Gabby's user avatar
  • 1
1 vote
3 answers
556 views

TypeError: Invalid schema configuration: `admin` is not a valid type at path `ADMIN`, NestJs mongodb with SWC

I'm first time working with SWC , and I'm facing this error only with SWC compiler. Without SWC everything works fine Error throw new TypeError(Invalid schema configuration: \${val}` is not ` + ^ ...
M Nouman's user avatar
  • 559
0 votes
1 answer
95 views

How to print log in swc plugin

This is my swc plugin repo https://github.com/coder-xiaotian/swc-useclient. I want to print log for debug. I tried to use tracing, but I still can't do it.
BruceWan's user avatar
1 vote
1 answer
501 views

Using multiple loaders in Node

Loaders in Node can be used to hook into the module loading process, intercepting import or require calls. This works fine, but sometimes you might want to use multiple loaders. For instance, you are ...
oligofren's user avatar
  • 22.2k
1 vote
1 answer
734 views

Problems with swc transpiler in node express.js with TypeScript

I'm using Sequelize to create a database to register users, but I'm running into a problem while transpiling the code, I get the below console error. [1] C:\Users\GONZALO\Desktop\proyecto_catalogador\...
NoahTakk's user avatar
1 vote
0 answers
87 views

Cannot import modules in node command

I have this npm command "create-new": "node --no-warnings --loader ts-node/esm tools/createNewCommand.ts" in tools directory. If I try to import from src/ I get this error: ...
user19210100's user avatar
2 votes
0 answers
2k views

@swc/jest and typescript does not allow jest to run tests

I'm using react, typescript and SWC to compile my project, also using @swc/jest as transformer in my jest config like below: module.exports = { ...some config transform: { '^.+\\.(t|j)sx?$': ...
amdev's user avatar
  • 7,251
2 votes
0 answers
1k views

How to properly configure swc-loader with webpack, when switching from ts-loader for better build performance

I have a ts-loader configuration in webpack, test: /\.tsx?$/, use: [ { loader: 'ts-loader', options: { transpileOnly: true } } ] This was taking like 5 mins of build time. so, ...
Adharsh M's user avatar
  • 3,612
2 votes
1 answer
1k views

Tsx files are not getting compile with swc?

I have the following swc configuration in place, but when I compile them with nest.js swc, the tsx files are not compiled at all and no artifact is created for them. { "$schema": "...
Kerem Kusmezer's user avatar
1 vote
0 answers
293 views

Can I write SWC plugins using Typescript/Javascript?

In 2023 there is no info about JS/TS API available for SWC plugins system on the documentation page, only rust-written plugins. I went through many github issues to find it out with no luck. I even ...
nickbullock's user avatar
  • 6,499
2 votes
0 answers
129 views

How cain i use SWC with MUI?

I started a proyect in vite using vite, when i stared to @mui/material i started to have problems with babel. I found out that that some people had that problem, because the version of babel they had ...
lucianopinochet's user avatar
3 votes
1 answer
3k views

SWC plugins not working / Any plugin I compile breaks Next js

The Next js framework uses the SWC compiler instead of Babel. I need to write a plugin for SWC. Everything was working fine, but something happened. Now any plugin that I compile on my computer doesn'...
Roman's user avatar
  • 485
0 votes
1 answer
132 views

rust / SWC plugin / how to test jsx?

I'm trying to create a plugin by doing the documentation - https://swc.rs/docs/plugin/ecmascript/getting-started I have simplified the example. The plugin doesn't change anything. test!( Default::...
Roman's user avatar
  • 485
10 votes
2 answers
14k views

"next/font" requires SWC although Babel is being used due to a custom babel config being present

Im facing this error when I try to run my Nextjs project using styled components. This is my .babelrc { "plugins": [ [ "babel-plugin-styled-components", { ...
Yuri Oliveira Gochi's user avatar
1 vote
1 answer
385 views

I have a problem when working with react-router-dom version 6 [duplicate]

Here is the problem, first this project is generated using vite. I have the error that says Warning: React does not recognize the activeStyle prop on a DOM element. That is a first few lines from the ...
Reynald Lamury's user avatar
1 vote
0 answers
190 views

Is there a way to omit a package or library from being minified or ignored by SWC?

So I am building an audio chatroom in Next.js. For the chatting and calling features, I am using Agora that makes use of the agora-rtm-sdk agora-rtm-sdk and agora-rtc-sdk-ng agora-rtc packages. So ...
Tim Mwaura's user avatar
2 votes
1 answer
1k views

Dynamic import failed with JEST and React testing library in nextjs 12 use SWC (not use babel)

I have problems about testing component that it's used dynamic import in nextjs 12. I show up some info about technical: NextJS 12 use SWC (not use babel) React 18 Jest + React testing library Here ...
san's user avatar
  • 1,645
1 vote
0 answers
310 views

@swc/jest produces non-class code even if target is set to 2021

My jest.config.js: module.exports = { testEnvironment: "jsdom", testMatch: ["**/*.spec.ts", "**/*.spec.js"], testPathIgnorePatterns: ["/test/"], // UUID ...
user910046's user avatar
0 votes
1 answer
375 views

A storybook error related to 'emotion' occurred in an environment using swc

I am using the existing babel and switching to swc. But the following error occurred. Error: Component selectors can only be used in conjunction with @emotion/babel-plugin, the swc Emotion plugin, or ...
Hyeongrok's user avatar
3 votes
0 answers
475 views

Next.js 13 + Styled Components "Warning: Prop className did not match." error - how to migrate from babel to SWC?

When upgrading the Next version from 12 to 13 I got the error "Warning: Prop className did not match." pointing to styled-components. My initial setup was with babel, including babel-plugin-...
Matilda Brunemalm's user avatar
8 votes
2 answers
9k views

swc not resolving import path aliases

I have a typescript project which I'm transpiling with swc. I'm having trouble getting swc to resolve path aliases defined in either tsconfig.json or .swcrc. The module aliases are resolved properly ...
minnow's user avatar
  • 343
2 votes
0 answers
157 views

How can I can get typescript to emit .js extension when importing modules?

In the browser this works: import blah from "../blah.js"; but if you don't specify the extension it doesnt: import blah from "../blah"; errors with I'm using typescript in an ...
Orión González's user avatar

15 30 50 per page
1
2 3 4 5 6