Skip to content

feat: support modify swc compile options #514

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

Merged
merged 4 commits into from
Mar 28, 2023

Conversation

luhc228
Copy link
Member

@luhc228 luhc228 commented Mar 27, 2023

支持使用 modifySwcCompileOptions 方法修改默认的 swc 配置:

const plugin = (api) => {
  const { onGetConfig } = api;
  onGetConfig(config => {
    config.modifySwcCompileOptions = (originOptions) => {
      const newOptions = { ...originOptions, env: { } };
      return newOptions;
    }
  });
};

@luhc228 luhc228 added the need review Need Review label Mar 27, 2023
@vercel
Copy link

vercel bot commented Mar 27, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated
icepkg ✅ Ready (Inspect) Visit Preview 💬 Add your feedback Mar 27, 2023 at 4:10AM (UTC)

@luhc228 luhc228 changed the title feat: support modify swc compile option feat: support modify swc compile options Mar 27, 2023
const plugin = (api) => {
const { onGetConfig } = api;
onGetConfig(config => {
config.modifySwcCompileOptions = (originOptions) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

config.type 可能是 transform 也可能是 bundle ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

恩,对。这里就演示 transform 和 bundle 模式都生效的

@luhc228 luhc228 requested a review from wssgcg1213 March 27, 2023 06:45
@luhc228 luhc228 merged commit 8cd4c98 into release-next Mar 28, 2023
@luhc228 luhc228 deleted the feat/support-modify-swc-compile-option branch March 28, 2023 04:12
@luhc228 luhc228 mentioned this pull request Apr 7, 2023
7 tasks
luhc228 added a commit that referenced this pull request Apr 10, 2023
* feat: support modify swc compile options

* chore: changeset

* docs: recommend to use modifySwcCompileOptions

* chore: update changelog
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
need review Need Review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants