You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The docs for @rollup/plugin-swc seem to be for TypeScript, and I'm using JavaScript and have no experience with TypeScript. This is my first experience with Node, Rollup, SWC, and packaging in general. I want to run the minification after I transpile with Babel, but Babel's minify makes that impossible because it processes the minification concurrently with the transpilation. I have tried using Terser and no joy there. The rollup-plugin-swc-minify works to my satisfaction in this regard, processing after Babel, but it doesn't allow clients to set minify options, instead it hard codes most all of them. I need to set some of those options.
Here is the example in the @rollup/plugin-swc readme:
But I don't understand how to use that inside my rollup-config.mjs file. How do I specify the SWC options inside the call to swc() in the plugins property? There is no example of that. I have tried a couple of things but always end up with default settings: transpilation and no minification. And a question that probably belongs elsewhere: How do I tell SWC not to transpile and only to minify? I can see how rollup-plugin-swc-minify does it, but that's inside a Rollup plugin using SWC API, not a Rollup config file using Options.
I could fork or copy rollup-plugin-swc-minify to hard code my options, or publish a plugin that lets users specify all the options, but I'd much rather use a plugin that's part of Rollup itself and properly supported.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
The docs for @rollup/plugin-swc seem to be for TypeScript, and I'm using JavaScript and have no experience with TypeScript. This is my first experience with Node, Rollup, SWC, and packaging in general. I want to run the minification after I transpile with Babel, but Babel's minify makes that impossible because it processes the minification concurrently with the transpilation. I have tried using Terser and no joy there. The rollup-plugin-swc-minify works to my satisfaction in this regard, processing after Babel, but it doesn't allow clients to set minify options, instead it hard codes most all of them. I need to set some of those options.
Here is the example in the @rollup/plugin-swc readme:
But I don't understand how to use that inside my rollup-config.mjs file. How do I specify the SWC options inside the call to
swc()
in theplugins
property? There is no example of that. I have tried a couple of things but always end up with default settings: transpilation and no minification. And a question that probably belongs elsewhere: How do I tell SWC not to transpile and only to minify? I can see how rollup-plugin-swc-minify does it, but that's inside a Rollup plugin using SWC API, not a Rollup config file using Options.I could fork or copy rollup-plugin-swc-minify to hard code my options, or publish a plugin that lets users specify all the options, but I'd much rather use a plugin that's part of Rollup itself and properly supported.
Beta Was this translation helpful? Give feedback.
All reactions