Commit 6855247
authored
feat(rspeedy): support source.preEntry (#750)
<!--
Thank you for submitting a pull request!
We appreciate the time and effort you have invested in making these
changes. Please ensure that you provide enough information to allow
others to review your pull request.
Upon submission, your pull request will be automatically assigned with
reviewers.
If you want to learn more about contributing to this project, please
visit:
https://github.com/lynx-family/lynx-stack/blob/main/CONTRIBUTING.md.
-->
## Summary
<!-- Can you explain the reasoning behind implementing this change? What
problem or issue does this pull request resolve? -->
<!-- It would be helpful if you could provide any relevant context, such
as GitHub issues or related discussions. -->
close #299
When we set `preEntry` in the `lynx.config.js`:
```js
source: {
entry: {
main: './src/index.tsx',
main2: './src/index.tsx',
},
preEntry: './src/normalize.css',
},
```
The `rspack.config.lynx.mjs` will automatically generate entries with
the following structure:
```js
main__main-thread: {
layer: 'react:main-thread',
'import': [
'/hotModuleReplacement.lepus.cjs',
'./src/normalize.css',
'./src/index.tsx'
],
filename: '.rspeedy/main/main-thread.js'
},
main: {
layer: 'react:background',
'import': [
'@lynx-js/react/refresh',
'@lynx-js/webpack-dev-transport/client',
'@rspack/core/hot/dev-server',
'./src/normalize.css',
'./src/index.tsx'
],
filename: '.rspeedy/main/background.js'
},
main2__main-thread: {
layer: 'react:main-thread',
'import': [
'/hotModuleReplacement.lepus.cjs',
'./src/normalize.css',
'./src/index.tsx'
],
filename: '.rspeedy/main/main-thread.js'
},
main2: {
layer: 'react:background',
'import': [
'@lynx-js/react/refresh',
'@lynx-js/webpack-dev-transport/client',
'@rspack/core/hot/dev-server',
'./src/normalize.css',
'./src/index.tsx'
],
filename: '.rspeedy/main/background.js'
},
```
The CSS files (`main.css` and `main2.css`) will contain:
```css
/* from preEntry normalize.css */
.test {
background-color: red;
}
/* The others */
:root {
background-color: #000;
--color-text: #fff;
}
```
## Checklist
<!--- Check and mark with an "x" -->
- [x] Tests updated (or not required).
- [x] Documentation updated (or not required).
---------
Signed-off-by: BitterGourd <[email protected]>1 parent 71db06c commit 6855247
File tree
7 files changed
+129
-17
lines changed- .changeset
- packages/rspeedy/core
- etc
- src/config
- rsbuild
- source
- test/config
- source
7 files changed
+129
-17
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
280 | 280 | | |
281 | 281 | | |
282 | 282 | | |
| 283 | + | |
283 | 284 | | |
284 | 285 | | |
285 | 286 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
68 | 68 | | |
69 | 69 | | |
70 | 70 | | |
| 71 | + | |
| 72 | + | |
71 | 73 | | |
72 | 74 | | |
73 | 75 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
429 | 429 | | |
430 | 430 | | |
431 | 431 | | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
432 | 455 | | |
433 | 456 | | |
434 | 457 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
803 | 803 | | |
804 | 804 | | |
805 | 805 | | |
| 806 | + | |
| 807 | + | |
| 808 | + | |
| 809 | + | |
| 810 | + | |
| 811 | + | |
| 812 | + | |
| 813 | + | |
| 814 | + | |
| 815 | + | |
| 816 | + | |
| 817 | + | |
| 818 | + | |
| 819 | + | |
| 820 | + | |
| 821 | + | |
| 822 | + | |
| 823 | + | |
| 824 | + | |
| 825 | + | |
| 826 | + | |
| 827 | + | |
| 828 | + | |
| 829 | + | |
| 830 | + | |
| 831 | + | |
| 832 | + | |
| 833 | + | |
| 834 | + | |
806 | 835 | | |
807 | 836 | | |
Lines changed: 22 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1822 | 1822 | | |
1823 | 1823 | | |
1824 | 1824 | | |
| 1825 | + | |
| 1826 | + | |
| 1827 | + | |
| 1828 | + | |
| 1829 | + | |
| 1830 | + | |
| 1831 | + | |
| 1832 | + | |
| 1833 | + | |
| 1834 | + | |
| 1835 | + | |
| 1836 | + | |
| 1837 | + | |
| 1838 | + | |
| 1839 | + | |
| 1840 | + | |
| 1841 | + | |
1825 | 1842 | | |
1826 | 1843 | | |
1827 | 1844 | | |
| |||
1879 | 1896 | | |
1880 | 1897 | | |
1881 | 1898 | | |
| 1899 | + | |
| 1900 | + | |
| 1901 | + | |
| 1902 | + | |
| 1903 | + | |
| 1904 | + | |
1882 | 1905 | | |
1883 | 1906 | | |
1884 | 1907 | | |
| |||
1903 | 1926 | | |
1904 | 1927 | | |
1905 | 1928 | | |
1906 | | - | |
1907 | | - | |
1908 | | - | |
1909 | | - | |
1910 | | - | |
1911 | | - | |
1912 | | - | |
1913 | | - | |
1914 | | - | |
1915 | | - | |
1916 | | - | |
1917 | | - | |
1918 | | - | |
1919 | | - | |
1920 | | - | |
1921 | | - | |
1922 | | - | |
1923 | 1929 | | |
1924 | 1930 | | |
1925 | 1931 | | |
| |||
2132 | 2138 | | |
2133 | 2139 | | |
2134 | 2140 | | |
| 2141 | + | |
| 2142 | + | |
| 2143 | + | |
| 2144 | + | |
| 2145 | + | |
| 2146 | + | |
| 2147 | + | |
| 2148 | + | |
| 2149 | + | |
| 2150 | + | |
2135 | 2151 | | |
2136 | 2152 | | |
2137 | 2153 | | |
| |||
0 commit comments