Questions tagged [swc-compiler]

For question about SWC (Speedy Web Compiler), a Rust-based JavaScript compiler.

70 questions
0
votes
0 answers

Importing undefined module (probably caused by circular reference)

I'm facing an issue where sometimes when I import a module it returns as undefined. It's not a directly issue with the module, I already tested unitarily BUT when i try to run it togheter, some modules come as undefined. I've already read some posts…
0
votes
0 answers

Desperatly need help to compile folders/files into a swc for Adobe AIR

My app has a bug and I discovered that it was caused by a swc file. I've got a swc file that my AIR app is using but I need to update it. I have all the source files. I found the bug in a .as file (that is included in the swc file) and updated…
user3094896
  • 195
  • 1
  • 8
0
votes
0 answers

Slightly larger file sizes when using SWC in Next JS

Updating a Next js project to use SWC over Babel, no problems building the project but all the files are slightly larger (2-10kb). // next.config.js module.exports = { ... compiler: { reactRemoveProperties: { properties:…
sujan basnet
  • 190
  • 2
  • 12
0
votes
0 answers

How to instrument code in Cypress with SWC ( not babel ) in NextJS?

I integrated Cypress into my project for testing, and everything went well, however, when I want to make code coverage I could not find a solution for my issue. In NextJS 13, it does not support .babelrc but SWC, however Istanbul requires .babelrc…
0
votes
0 answers

How to force NestJS not to start on the type-check error?

Recently I switch from tsc to swc compiler in my NestJS app. I have a problem with start:dev command. With tsc if in the code were some type errors app didn't start and it was ok because, on the bottom of the console, I had a list of errors. Now,…
feamor
  • 13
  • 4
0
votes
1 answer

Recharts data doesn't load unless I hit ctrl+s

I created a LineChart using recharts and I'm pulling data using axios from a db.json file hosted locally by json-server. Every time I load the page or reload the chart doesn't show up. Only when I hit ctrl+s to save my file and trigger re-render…
0
votes
0 answers

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, to improve the build time I switched to…
Adharsh M
  • 2,961
  • 3
  • 16
  • 23
0
votes
0 answers

Next.js SWC - ESLint is unable to resolve path to module with aliases

I'm migrating my Next.js project from Babel compiler to Next.js SWC-powered compiler - https://nextjs.org/docs/architecture/nextjs-compiler After the necessary changes the app itself works fine, however inside the app there are imports that were…
Kosmetika
  • 20,774
  • 37
  • 108
  • 172
0
votes
0 answers

Transpiled code says it does not provide a default export named AppCosmosClient when imported

What I'm trying to do I'm trying to install a local node package (common) to the target folder (web). Use TypeScript in the common folder and transpile the code in common/src using Speedy Web Compiler (SWC) and have its output to common/dist. Then…
Afiq Rosli
  • 357
  • 1
  • 7
  • 22
0
votes
0 answers

Using a ts-loader custom transformer with NextJS

I've fallen in love with the ts-runtime-checks library and want to incorporate it into my NextJS project: issue is that it's a code transformer (changes how code compiles) and needs to be run before the main typescript compilation. Is there a way to…
Mikolaj Figurski
  • 133
  • 1
  • 2
  • 12
0
votes
0 answers

swc / I need a global variable for the duration of the plugin

I am creating an SWC plugin. I will be as brief as possible. The user can style HTML (jsx) elements with attributes.
123
The plugin adds a class attribute with a unique id.
123
And…
Roman
  • 175
  • 2
  • 3
  • 15
0
votes
0 answers

Get string from JSXAttrValue (swc)

I am creating a SWC plugin using rust. I have a JSXAttrValue enum. How to get a string from it? fn visit_mut_jsx_attr_value(&mut self, n: &mut JSXAttrValue) { let value = ?????; } I need the ability to compare "value" with a string or…
Roman
  • 175
  • 2
  • 3
  • 15
0
votes
0 answers

is it possible to create css using SWC in Next js?

I am creating a SWC plugin for Next js. I have no problem finding the "background" attribute.
Using SWC, I add a unique class to this element instead of an attribute.
I need to create…
Roman
  • 175
  • 2
  • 3
  • 15
0
votes
0 answers

How to set attribute (JSXAttr) in SWC plugin using rust

I need to set attributes on elements. fn visit_mut_jsx_opening_element(&mut self, n: &mut JSXOpeningElement){ } JSXOpeningElement finds all opening elements Please see its content -…
Roman
  • 175
  • 2
  • 3
  • 15
0
votes
0 answers

Next js doesn't run with SWC plugin / rust plugin

I create the first plugin exactly like in the documentation - https://swc.rs/docs/plugin/ecmascript/getting-started I didn't change anything after: swc plugin new --target-type wasm32-wasi my-first-plugin. Plugin does nothing. add to Next js: const…
Roman
  • 175
  • 2
  • 3
  • 15