Closed xymopen closed 2 months ago
Can you add some test cases?
Can you add some test cases?
I don't have much experience on that. Can you provide some examples?
Can you add some test cases?
I don't have much experience on that. Can you provide some examples?
The include
and exclude
control the rules that determine which modules have code injected by the loader. So you can require some modules, and exclude some of them. Then try to check the number of occurrences of the injected code which should be equal to the number of modules remain.
I was trying to fit test from @rspack/plugin-react-refresh, however Jest would complain about timeout and done()
not being called. Also the prefresh runtime seems to only be injected during HMR. I was trying to understand @rspack/test-tools but the readme on npm only lead me to rspack website and there is no documentation for the package. Can you give me some help?
I was trying to fit test from @rspack/plugin-react-refresh, however Jest would complain about timeout and
done()
not being called. Also the prefresh runtime seems to only be injected during HMR. I was trying to understand @rspack/test-tools but the readme on npm only lead me to rspack website and there is no documentation for the package. Can you give me some help?
You can see this doc. And the code is here. You can try to add some debug code in next
function.
When this function is called, the compiler will build again and then the module content will be changed by this loader. Then hot-update.json
and hot-update.js
will be generated and loaded by runtime, and then the callbacks registered by module.accept
will be called. In this callback you should call the done
of jest to end this test case.
I've add some tests. Ping me if you find something wrong.
LGTM, thanks for your contribution
This PR aims to add the
include
andexclude
option like the@rspack/plugin-react-refresh
.These options are helpful when works with
svgr
andmdx
, or prevent runtime injection to other packages sharing the same workspace.