rollup-plugin-swc

Use SWC with Rollup to transform / minify ESNext and TypeScript code.

MIT License

Downloads
132.7K
Stars
153
Committers
11

Bot releases are hidden (Show)

rollup-plugin-swc - 0.11.2 Latest Release

Published by SukkaW 5 months ago

  • New feature viteMinify to use swc's minification in Vite.

    • When used, it will disable Vite's built-in minification and use swc's minification instead.
    import { defineConfig } from 'vite';
    import { viteMinify } from 'rollup-plugin-swc3'
    
    export default defineConfig({
      plugins: [
        viteMinify({
          // swc's minify option here
          // mangle: {}
          // compress: {}
        }),
      ],
    })
    
rollup-plugin-swc - 0.11.1

Published by SukkaW 6 months ago

  • Fix #63
    • Previously, rollup-plugin-swc3 only handled relative compilerOptions.baseUrl when compilerOptions.paths is specified. It is fixed in #64, now rollup-plugin-swc3 will handle relative compilerOptions.baseUrl as long as it is specified.
rollup-plugin-swc - 0.11.0

Published by SukkaW 11 months ago

  • Fix #58
    • rollup-plugin-swc3 now will only perform module resolution inside the files specified in include and exclude options.
  • Replace rollup-swc-preserve-directives with rollup-preserve-directives
rollup-plugin-swc - 0.10.2

Published by SukkaW about 1 year ago

0.10.2

  • Add warning messages when tsconfig is invalid
  • Add rollup 4 official support
rollup-plugin-swc - 0.10.1

Published by SukkaW about 1 year ago

  • Fix #41
    • rollup-plugin-swc3 now will always provide baseUrl (resolve to an absolute path) to swc as long as the paths is specified in the tsconfig.json or jsconfig.json being read.
rollup-plugin-swc - 0.10.0

Published by SukkaW about 1 year ago

rollup-plugin-swc - 0.9.1

Published by SukkaW over 1 year ago

The support for 'use client' and 'use server' has been separated into a standalone rollup plugin rollup-swc-preserve-directives, maintained by @huozhi and me. The previous preserveUseDirective named export is retained for the backward compatibility.

rollup-plugin-swc - 0.9.0

Published by SukkaW over 1 year ago

  • Add support for bundling library for React Server Component with the proper 'use client' and 'use server' directives handling:

    • Merge duplicated directives in the final bundles
    • Multiple output chunks will have their own separated directives, useful when bundling client only code and server only code in different bundles.
    • Not enabled by default. manually opt-in by changing two lines of code in your rollup.config.js:
    // rollup.config.js
    // Import `preserveUseDirective` from `rollup-plugin-swc3`...
    - import { swc } from 'rollup-plugin-swc3';
    + import { swc, preserveUseDirective } from 'rollup-plugin-swc3';
    
    export default {
      input: 'xxxx',
      output: {},
      plugins: [
        swc(),
    +   preserveUseDirective()
      ];
    }
    
rollup-plugin-swc - 0.8.2

Published by SukkaW over 1 year ago

0.8.2

  • Enable CI auto publish release + npm provenance
rollup-plugin-swc - 0.8.1

Published by SukkaW over 1 year ago

  • Fix TypeScript declaration of include and exclude option (#32)
rollup-plugin-swc - 0.8.0

Published by SukkaW almost 2 years ago

  • Add new option extensions.
    • Along with include / exclude, this provides a granular way to specify the files that will be processed by the plugin.
    • For extensionless imports, the plugin will search and resolve files for extensions in the order specified.
rollup-plugin-swc - 0.7.0

Published by SukkaW about 2 years ago

  • Add Rollup 3.0.0 support.
    • rollup-plugin-swc now supports both Rollup 2 and Rollup 3.
rollup-plugin-swc - 0.6.0

Published by SukkaW about 2 years ago

  • Supports extends from tsconfig.json/jsconfig.json.
  • Supports passing a full path of a tsconfig.json/jsconfig.json file to tsconfig option.
  • When finding the nearest tsconfig.json/jsconfig.json from the source file that is currently being transpiled, rollup-plugin-swc's behavior is now aligned with tsc.
rollup-plugin-swc - 0.5.0

Published by SukkaW about 2 years ago

  • rollup-plugin-swc now also respects jsx option from tsconfig.json when no corresponding swc option is provided.
    • jsxImportSource from tsconfig.json will be passed to swc's jsc.transform.react.importSource
    • if tsconfig.json specifies jsx: react-jsx or jsx: react-jsxdev, rollup-plugin-swc will set jsx.tramsform.react.runtime to automatic, otherwise it will be classic.
      • Currently, swc doesn't support preserving JSX, and will always transpile JSX into javascript code.
    • rollup-plugin-swc will also set jsx.tramsform.react.development to true if tsconfig.json specifies jsx: react-jsxdev.
rollup-plugin-swc - 0.4.2

Published by SukkaW about 2 years ago

Remove unused dependency (@huozhi #20)

rollup-plugin-swc - 0.4.1

Published by SukkaW about 2 years ago

rollup-plugin-swc - 0.4.0

Published by SukkaW about 2 years ago

  • Automatically pass rollup's file id to swc's filename option.
    • It should help swc find the .swcrc, and also enables some other swc's functionality
  • Automatically mapping .ts/.tsx to .mjs/.js/.cjs/.jsx.
    • When using native ESM, import path requires .js/.jsx extension for TypeScript with "moduleResolution": "Node16". So rollup-plugin-swc will now try all possible extensions.
    • E.g. if you write import Foo from 'foo.jsx', rollup-plugin-swc will search for foo.ts, foo.tsx, foo.mjs, foo.js, foo.jsx.
    • PRs are welcome if you want to make rollup-plugin-swc more spec compliant.
rollup-plugin-swc - 0.3.0

Published by SukkaW over 2 years ago

  • Completely disable swc minify during rollup's transform phase.
    • Now all minify will be done in rollup's renderChunk phase, which is a one-pass process, resulting in even faster build performance.
  • Remove the workaround for rollup's virtual module that is introduced in 0.1.2 (https://github.com/SukkaW/rollup-plugin-swc/pull/1)
    • swc has fixed the issue, and the corresponding test case has been added in https://github.com/swc-project/swc/pull/4255
    • The peerDependencies of swc has been updated to >=1.2.165. You will need to bump the version of swc to 1.2.165 or higher after this release.
rollup-plugin-swc - 0.2.0

Published by SukkaW over 2 years ago

  • Standalone minify plugin
  • Support reading baseUrl and paths from your tsconfig.json (and jsconfig.json).
rollup-plugin-swc - 0.1.4

Published by SukkaW almost 3 years ago

  • Add .mjs extension support
  • Export a default for use with rollup's --configPlugin