Comments (8)
You can remove the warning by using optimizer and server config:
test: {
server: {
deps: {
// fixes: You appear to have multiple instances of Solid. This can lead to unexpected behavior.
inline: [/solid-js/],
},
},
deps: {
// fixes: Vitest "deps.registerNodeLoader" is deprecated. If you rely on aliases inside external packages, use "deps.optimizer.web.include" instead.
optimizer: {
web: {
enabled: true,
},
},
},
}
https://github.com/vitest-dev/vitest/releases/tag/v0.34.0
From release notes:
Deprecate deps.registerNodeLoader - by @sheremet-va (7f45b)
This option was introduced to support aliasing inside external packages. Please, use deps.optimizer.web instead. If you test Node.js applications, consider adding external packages to server.deps.inline.
from vite-plugin-solid.
Why is that not working for me?
- vitest 0.34.6
- vite 4.5.0
- vite-plugin-solid 2.7.2
My vitest.config.ts
![Снимок экрана 2023-11-20 в 11 51 04](https://private-user-images.githubusercontent.com/9642686/284206854-61f9340d-282c-4c6d-b9dc-983792063869.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjM2NjQwODgsIm5iZiI6MTcyMzY2Mzc4OCwicGF0aCI6Ii85NjQyNjg2LzI4NDIwNjg1NC02MWY5MzQwZC0yODJjLTRjNmQtYjlkYy05ODM3OTIwNjM4NjkucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI0MDgxNCUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNDA4MTRUMTkyOTQ4WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9M2FjNGZiMzFiOTUzODBhNzEzNjUwNDdiNWEwMzVhNjA3NDBjYjFjZWIzMDJlMTIyMzgxNDdiMDhlZTQxZmE3ZiZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmYWN0b3JfaWQ9MCZrZXlfaWQ9MCZyZXBvX2lkPTAifQ.5FSP_XLSOo6BkyXJP0gdzeY6GQcTwXb16rmp4sI8v8M)
from vite-plugin-solid.
@Tur8008 I was also unable to suppress the deprecation message using the above recommendations.
This message seems to be caused by the SolidPlugin()
's returned config-patch object that contains the deprecated property:
vite-plugin-solid/src/index.ts
Line 338 in 7e667ad
I was able to develop a workaround that patches-out the deprecated property (setting it to undefined
) which effectively suppresses the deprecation message when running vitest
:
[email protected]
[email protected]
[email protected]
.
- import { defineConfig } from "vitest/config";
+ import { type UserConfig, defineConfig } from "vitest/config";
import SolidPlugin from "vite-plugin-solid";
export default defineConfig({
// ...
plugins: [
- SolidPlugin(),
+ // @workaround
+ // `"deps.registerNodeLoader" is deprecated.`
+ (() => {
+ const plugin = SolidPlugin();
+ const { config } = plugin;
+ return Object.assign(plugin, {
+ config: async (...args: any[]) => {
+ const result: UserConfig = await (config as any)(...args);
+ if (result.test?.deps?.registerNodeLoader) {
+ result.test.deps.registerNodeLoader = undefined;
+ }
+ return result;
+ },
+ });
+ })(),
],
// ...
});
I'm not sure whether or not this patched-out property will cause any other problems -- but for now it seems okay!
[edit 1] Sorry, it seems to completely crash vite dev
with TypeError: Cannot read properties of undefined (reading 'deps')
-- I'll have to look into it further.
[edit 2] Turns out I made a mistake in the original version of my workaround diff causing a config error if not running in the "test" mode
. I've fixed my code snippet to first check for the property before attempting to clear it.
from vite-plugin-solid.
Same with me. Another weird thing that I cannot figure out for the life of me @jtmueller is that when I have the vite-plugin-solid
plugin enabled in my vite config, my tests all are duplicated (they each run twice)!! Have you noticed this at all? It is driving me insane, haha. See here: #112 (comment)
from vite-plugin-solid.
@alarivan Thanks, that gets rid of the warning for me - I was logging the issue mostly so that the next version of vite-plugin-solid wouldn't trigger the deprecation warning by default, but I appreciate the workaround.
@GitMurf I was seeing the deprecation warning twice, but at least after applying the above workaround, the actual tests don't seem to run more than once.
from vite-plugin-solid.
@GitMurf I was seeing the deprecation warning twice, but at least after applying the above workaround, the actual tests don't seem to run more than once.
When I am running my unit tests with
vitest
, whenever I use my main vite config that has thevite-plugin-solid
included, it runs my tests twice!
FYI see this thread for the solution to my additi issue mentioned above: #101 (comment)
from vite-plugin-solid.
Works also with [email protected]
, [email protected]
and [email protected]
from vite-plugin-solid.
Works also with
[email protected]
,[email protected]
and[email protected]
Yepp! Just have updated site-plugin-solid up to 2.9.1 and problem has gone. Thank you! They fixed that, at last.
from vite-plugin-solid.
Related Issues (20)
- Upgrade compatibility with Vite 5 HOT 3
- alias normalization breaks config
- Not working with happy-dom
- 2.8.1 vite dev server : Uncaught ReferenceError: _tmpl$ is not defined HOT 6
- Interpolation syntax error causes unhelpful "Invalid raw" error
- scope.registerDeclaration(declarationPath) error with vite-plugin-solid 2.8.2 HOT 6
- peerDependencyMeta in package.json should be peerDependenciesMeta
- vite-plugin-solid v2.8.3+ causes: `TypeError: Cannot read properties of undefined (reading 'extend')` HOT 1
- missing changelog / release tags HOT 1
- optimizeDeps.include will produce the React version of the jsx result HOT 1
- I updated `vite-plugin-solid` and now namespaces merged with components are no longer allowed HOT 11
- Unable to pass signal to child components HOT 5
- Breaking updating from v2.9.1 from v2.10.0 HOT 1
- Should omitNestedClosingTags be actually required? HOT 1
- HMR not work in "solid-ts" template HOT 1
- Vite does not load proper build (server) on ssr webworker build HOT 5
- feature: SWC support
- Put packge into `@solidjs` namespace
- Vitest fails with TypeError: Unknown file extension ".jsx" HOT 5
- [vite] server connection lost. Polling for restart...
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vite-plugin-solid.