8000 swc-loader does not expose `filename` or other programmatic options to plugins · Issue #36 · 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 does not expose filename or other programmatic options to plugins #36

Open
rametta opened this issue Jan 24, 2022 · 1 comment

Comments

@rametta
Copy link
rametta commented Jan 24, 2022

When using swc, there is an option for providing the filename which can be passed down to plugins, but when using the swc-loader, the filename is not passed au B205 tomatically as in the way babel-loader does it.

This makes it impossible for swc plugins using swc-loader to know the current filename and path being processed and have logic around that, along with all the other swc programatic options that could be useful to plugins.

@rametta rametta changed the title swc-loader does not expose filename or other programatic options to plugins swc-loader does not expose filename or other programmatic options to plugins Jan 24, 2022
@PepijnSenders
Copy link

@rametta I created a patch for our SWC loader:

programmaticOptions.plugin = programmaticOptions.plugin({
  filename,
  sourceFileName: programmaticOptions.sourceFileName
});

The loader has the filename, and just passing the plugin to the loader like this: (options) => (m) => new SWCPlugin(options).visitProgram(m). Not the cleanest, so not sure if I'll create a PR for this yet, but works for us.

ssddi456 added a commit to ssddi456/swc-loader that referenced this issue Jul 13, 2022
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