Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ability to modify import extensions, like ".scss" to ".css" #9614

Open
wermanoid opened this issue Oct 4, 2024 · 1 comment
Open

Ability to modify import extensions, like ".scss" to ".css" #9614

wermanoid opened this issue Oct 4, 2024 · 1 comment

Comments

@wermanoid
Copy link

Describe the feature

I'm trying to migrate away from @babel to swc, and stuck with this one issue.
We're using .scss files for development and processing those into css during builds.

In case of @babel - it is possible to setup transformation, that will change sass/less into css. And there is ability to work with import extensions in general.

Only thing that I've found for SWC was this - swc-project/plugins#47 and, unfortunately, this behavior was fixed and not available any more.

Can you add ability to change imports during builds? You know, this is pretty weird idea to go away from babel, so later I would have to use swc + babel to finalize compilation.

Or there is already something to implement similar logic (except use babel to process compiled code)?

Babel plugin or link to the feature description

transform-rename-import

Additional context

No response

@dr2009
Copy link

dr2009 commented Nov 13, 2024

just add handleDefaultImport: true

[
  '@swc/plugin-transform-imports',
  {
    '^(.*?)(\\.scss)$': {
      handleDefaultImport: true,
      transform: '{{matches.[1]}}.css',
    },
  },
],

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

5 participants
@dr2009 @wermanoid and others