-
Notifications
You must be signed in to change notification settings - Fork 156
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: change the check rule of the rsdoctor plugin
fix: rsdoctor plugin fix: rsdoctor plugin feat: support add plugins for specified environment (#2986) Co-authored-by: neverland <[email protected]> Update packages/core/src/plugins/rsdoctor.ts Co-authored-by: neverland <[email protected]> Update packages/core/src/plugins/rsdoctor.ts Co-authored-by: neverland <[email protected]> Update packages/core/src/plugins/rsdoctor.ts Co-authored-by: neverland <[email protected]> fix: modify the criteria for verifying the Rsdoctor plugin.
- Loading branch information
Showing
29 changed files
with
894 additions
and
228 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
import { build, gotoPage } from '@e2e/helper'; | ||
import { expect, test } from '@playwright/test'; | ||
|
||
import { pluginReact } from '@rsbuild/plugin-react'; | ||
|
||
test('should add single environment plugin correctly', async ({ page }) => { | ||
const rsbuild = await build({ | ||
cwd: __dirname, | ||
rsbuildConfig: { | ||
environments: { | ||
web: { | ||
output: { | ||
filenameHash: false, | ||
}, | ||
plugins: [pluginReact()], | ||
}, | ||
web1: { | ||
source: { | ||
entry: { | ||
main: './src/index1.ts', | ||
}, | ||
}, | ||
output: { | ||
assetPrefix: 'auto', | ||
filenameHash: false, | ||
distPath: { | ||
root: 'dist/web1', | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
runServer: true, | ||
}); | ||
|
||
await gotoPage(page, rsbuild); | ||
|
||
const button = page.locator('#test'); | ||
await expect(button).toHaveText('Hello Rsbuild!'); | ||
|
||
const web1Url = new URL(`http://localhost:${rsbuild.port}/web1/main`); | ||
|
||
await page.goto(web1Url.href); | ||
|
||
await expect(page.locator('#test1')).toHaveText('Hello Rsbuild!'); | ||
|
||
const files = await rsbuild.unwrapOutputJSON(); | ||
const filenames = Object.keys(files); | ||
|
||
expect( | ||
filenames.some((filename) => | ||
filename.includes('dist/static/js/lib-react.js'), | ||
), | ||
).toBeTruthy(); | ||
expect( | ||
filenames.some((filename) => | ||
filename.includes('dist/web1/static/js/lib-react.js'), | ||
), | ||
).toBeFalsy(); | ||
}); |
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 @@ | ||
const App = () => <div id="test">Hello Rsbuild!</div>; | ||
|
||
export default App; |
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,9 @@ | ||
import React from 'react'; | ||
import { createRoot } from 'react-dom/client'; | ||
import App from './App'; | ||
|
||
const container = document.getElementById('root'); | ||
if (container) { | ||
const root = createRoot(container); | ||
root.render(React.createElement(App)); | ||
} |
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,5 @@ | ||
document.getElementById('root').innerHTML = ` | ||
<div> | ||
<div id="test1">Hello Rsbuild!</div> | ||
</div> | ||
`; |
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
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
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
Oops, something went wrong.