-
Notifications
You must be signed in to change notification settings - Fork 163
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: support for SWC experimental plugins (#1796)
- Loading branch information
1 parent
c280511
commit 9c1366a
Showing
7 changed files
with
87 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import { expect, test } from '@playwright/test'; | ||
import { dev, build, gotoPage } from '@e2e/helper'; | ||
|
||
// TODO: https://github.com/web-infra-dev/rspack/issues/5921 | ||
test.skip('should run swc warm plugin correctly in dev mode', async ({ | ||
page, | ||
}) => { | ||
const rsbuild = await dev({ | ||
cwd: __dirname, | ||
}); | ||
|
||
const msgPromise = page.waitForEvent('console'); | ||
await gotoPage(page, rsbuild); | ||
|
||
const msg = await msgPromise; | ||
expect(await msg.args()[0].jsonValue()).toEqual('this is error'); | ||
|
||
await rsbuild.close(); | ||
}); | ||
|
||
test.skip('should run swc warm plugin correctly in production build', async ({ | ||
page, | ||
}) => { | ||
const rsbuild = await build({ | ||
cwd: __dirname, | ||
runServer: true, | ||
}); | ||
|
||
const msgPromise = page.waitForEvent('console'); | ||
await gotoPage(page, rsbuild); | ||
|
||
const msg = await msgPromise; | ||
expect(await msg.args()[0].jsonValue()).toEqual('this is error'); | ||
|
||
await rsbuild.close(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"private": true, | ||
"name": "@e2e/swc-plugin", | ||
"version": "1.0.0", | ||
"dependencies": { | ||
"@swc/plugin-remove-console": "^1.5.117" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { defineConfig } from '@rsbuild/core'; | ||
|
||
export default defineConfig({ | ||
tools: { | ||
swc: { | ||
jsc: { | ||
experimental: { | ||
plugins: [ | ||
[ | ||
'@swc/plugin-remove-console', | ||
{ | ||
exclude: ['error'], | ||
}, | ||
], | ||
], | ||
}, | ||
}, | ||
}, | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
console.log('this is log'); | ||
console.warn('this is warn'); | ||
console.error('this is error'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.