-
Notifications
You must be signed in to change notification settings - Fork 131
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: allow to enable Rspack
experiments.css
(#3068)
- Loading branch information
1 parent
253ca44
commit cb548a1
Showing
12 changed files
with
87 additions
and
1 deletion.
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,45 @@ | ||
import { build, proxyConsole, rspackOnlyTest } from '@e2e/helper'; | ||
import { expect } from '@playwright/test'; | ||
|
||
rspackOnlyTest('should allow to enable Rspack experiments.css', async () => { | ||
const { logs, restore } = proxyConsole(); | ||
|
||
const rsbuild = await build({ | ||
cwd: __dirname, | ||
}); | ||
const files = await rsbuild.unwrapOutputJSON(); | ||
const content = | ||
files[Object.keys(files).find((file) => file.endsWith('index.css'))!]; | ||
|
||
expect(content).toEqual('body{color:red}'); | ||
// should have no warnings | ||
expect(logs.some((log) => log.includes('Compile Warning'))).toBeFalsy(); | ||
|
||
restore(); | ||
}); | ||
|
||
rspackOnlyTest( | ||
'should allow to enable Rspack experiments.css with style-loader', | ||
async () => { | ||
const { logs, restore } = proxyConsole(); | ||
|
||
const rsbuild = await build({ | ||
cwd: __dirname, | ||
rsbuildConfig: { | ||
output: { | ||
injectStyles: true, | ||
}, | ||
}, | ||
}); | ||
|
||
const files = await rsbuild.unwrapOutputJSON(); | ||
const content = | ||
files[Object.keys(files).find((file) => file.endsWith('index.js'))!]; | ||
expect(content).toContain('color: red;'); | ||
|
||
// should have no warnings | ||
expect(logs.some((log) => log.includes('Compile Warning'))).toBeFalsy(); | ||
|
||
restore(); | ||
}, | ||
); |
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,14 @@ | ||
import { defineConfig } from '@rsbuild/core'; | ||
|
||
export default defineConfig({ | ||
tools: { | ||
rspack: { | ||
experiments: { | ||
css: true, | ||
}, | ||
}, | ||
}, | ||
output: { | ||
filenameHash: false, | ||
}, | ||
}); |
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 @@ | ||
body { | ||
color: red; | ||
} |
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 @@ | ||
import './index.css'; |
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
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