How can I rewrite this code for the moved SyntaxContext?
I'm upgrading the Qwik optimizer and this code no longer works because expr.span no longer has the SyntaxContext.
However, the only other property is
expr.expr
which is a Box<Expr>
.
How can I get at the syntax context to add the mark? Or is this the wrong approach and should I be doing one of https://swc.rs/docs/plugin/ecmascript/cheatsheet#deleting-node ? I'm not sure how to apply that though, since it marks by making the name invalid and then removes, but here I need to retain what's marked.
...what happened with swc_ecmascript::visit::visit_expr?
I can't find the PR nor commit that removed it, nor any discussions. It's no longer exported and I don't know what to replace it with. My code is
```rust
impl Visit for IdentCollector {
noop_visit_type!();...
How to debug in Rust
When I'm stepping through the code, the AST is binary data. I end up having to put a lot of dbg! statements.
Is there a better way to see what the current state is?...
How to replace typescript::strip_with_jsx
In 1.3.89 typescript got overhauled and that removed typescript::strip_with_jsx.
What should I do instead now?...
How to test a visitor that uses visit_mut_script?
Let's say you have a visitor, something like this
```rust
struct Visitor;
impl VisitMut for Visitor {...
Folder import resulting in undefined
Having a tonne of trouble with trying to get swc working with jest as doing a folder import results in an empty object:
->...
import * as x from '..';
import * as x from '..';
Transforming `import.meta` with jest and swc
I've spent a few hours trying to find how this is meant to work with jest and swc.
config:
```json
{
"jsc": {...
How to compile using your own custom plugin?
I created this discussion (https://github.com/swc-project/swc/discussions/7385) but thought I'd make a post here too to try get a response faster.
I don't understand how I'm supposed to apply custom transformations to a given JavaScript file. I'm using the
swc compile
command (from cargo install swc_cli
), but the transformations aren't applied on the produced output. Even using a config like this with a plugin like https://github.com/williamtetlow/swc-plugin-console-prefix doesn't apply the transformations:
```json
{...OOM with emotion plugin?
I was looking at adopting swc with the emotion plugin in one of our repositories when I hit this:
``
Caused by:
0: failed to invoke
@swc/plugin-emotion` as js transform plugin at ../../node_modules/@swc/plugin-emotion/swc_plugin_emotion.wasm
1: RuntimeError: out of bounds memory access...Fallback bindings does not support legacy plugins
Fallback bindings does not support legacy plugins, it'll be ignored.
i got this error, what does this mean?
note im using parallel vm in m1 macbook
with Windows 11 arm...