I encountered this line of code in a vue project here https://github.com/InfinetyEs/Nova-Filemanager/blob/c6595c29e23cab01be6b7e37a069b13844397c91/resources/js/modules/Image.vue#L42:
import Viewer from 'v-viewer/src/component.vue';
I know from other examples that v-viewer is the dependency, so src/component.vue isn't part of this project. However, those other examples are only importing the dependency, i.e. import Viewer from 'v-viewer'.
The issue I'm facing is that npm run dev is complaining that it cannot find the dependency and I have practically 0 experience with vue.
What is the proper way to write the above so that it is pulling component.vue from the dependency v-viewer?
Thank you!
UPDATE: I wrote this import { component } from 'v-viewer' and it compiled. Appreciate if someone can confirm and explain if what I'm doing is correct.
The project relies on v-viewer internals, which is a dangerous thing to do because they aren't guaranteed to exist.
This is the case here. There is loose version constraint, "v-viewer": "^1.4.2", and src was removed in later versions. You can either fix it to be "v-viewer": "1.4.2", or import and use it like shown in the documentation:
import { component as Viewer } from "v-viewer"
The latter solution is more preferable because this is the way the package was designed to be used without relying on its internals.
Related
I'm trying to migrate existing Karate project from 0.8.0 to 0.9.5
but facing some issues like below
1)None of the below imports are working, Need to figure it out equalling ones from 0.9.5
Looking for help from other, who has already tried this
import com.intuit.karate.cucumber.CucumberUtils;
import com.intuit.karate.cucumber.FeatureWrapper;
import com.intuit.karate.cucumber.KarateFeature;
import com.intuit.karate.cucumber.KarateJunitAndJsonReporter;
import com.intuit.karate.cucumber.KarateJunitFormatter;
import com.intuit.karate.cucumber.KarateReporter;
import com.intuit.karate.cucumber.KarateRuntime;
import com.intuit.karate.cucumber.KarateRuntimeOptions;
import com.intuit.karate.cucumber.KarateStats;
import com.intuit.karate.filter;
2)import com.intuit.karate.cucumber.CucumberRunner;- stating as Deprecated already, need to know replacement of this, my baseClass extends CucumberRunner.
3)also need to know replacement for below also
import com.intuit.karate.cucumber.FeatureFilePath;
import com.intuit.karate.cucumber.FeatureWrapper;
import com.intuit.karate.ScriptContext;
above imports are using in parsing Feature file
public static FeatureFilePath parseFeaturePath(File file) {
Please suggest tips to get this migration done successfully.
Thank you,
Jay
Sorry, only KarateStats was designed as a public API which is replaced by com.intuit.karate.Results. And CucumberRunner is replaced by com.intuit.karate.Runner. These are clearly mentioned in the release notes for 0.9.0.
The core of Karate was completely written and things like the KarateFeature and FeatureWrapper don't even exist anymore. I would say whoever decided to use or extend these classes made a very bad decision, and we never documented or encouraged any such approach. All the best !
I am working on a web visualisation for a given project (db with genes, proteins, task is to do some nice visualisation with springboot and thymeleaf). The project was provided with all files, yet I am missing some libraries (also leading to some errors in the code ofc).
When trying to import:
import org.apache.commons.lang3.tuple.ImmutablePair;
import org.apache.commons.lang3.tuple.Pair;
lang3 gives me a "cannot resolve symbol" error and automatically searching jars on web results in "no jars found".I found the lang3-jar manually and successfully added it to the project library. When importing:
import org.apache.commons.lang3.*;
All errors for tuple.Pair-usage are gone. Yet, usage of ImmutablePair still results in a "cannot resolve symbol" error.
Firstly, I am confused and now unsure, if my knowledge of imports is correct. I learned, if for example you import something.anything.x and something.anything.y, you could also just import something.anything.*; and x and y would be covered.
Secondly, if needed, where do I find the jars I need (I could not find them yet).
Thanks :)
So, I do not know, where this error results in, yet I do know a solution. When adding the library, select "From Maven" and search for Apache lang3 and add it. Resolves the problems.
I was trying to make a react-native app with redux, which is a counter. I was using snack.expo.io website in PC and expo app in Android, as I can't run it plainly in my system due to limitations .The app runs but when i click any of the buttons, it shows the error:
" Failed to install module 'react-redux':
Attempted to import missing module 'redux'
imported from App.js"
The snack.expo.io page i made is given here
I did add the 'redux' and 'react-redux' into the package.json file. Still it shows the same error.
What did I do wrong, or is there any other way to use 'redux' and 'react-redux' in expo?
I saw the same app being run on a system using npm and all. So I suspect it is a problem with snack.expo.io, as the import for the libraries mentioned are not working.
Do look through the code and let me know what I can do.
Update:
The documentation in which all modules available in snack contains 'redux' and 'react-redux' as shown in the answer by Tetsuya3850.
https://forums.expo.io/t/modules-available-in-snack/1651
Snack is constantly changing and right now and it seems to be throwing the wrong error. I downloaded your snack and ran it with exp the expo command line tool. This revealed a few syntax errors which can be simply resolved! 💙
counterActions.AddNumber -> counterActions.addNumber
counterActions.DecrementCount -> counterActions.decrementCount
There is also another error related to formatting: Actions must be plain objects. Use custom middleware for async actions.
I'll share this with TC the dev working on snack, he's pretty good at
fixing these kinds of problems.😁
A lazy man's opinion of Redux
It looks like you are running into some of the usual errors of standard Redux.
Standard Redux gives me chest pain 😵 - I highly recommend using Rematch! 🔥💯
Rematch is a standard format for Redux, you may have noticed that
everyone formats a little different.
A lot less code and much easier to manage. Because of how it's structured you tend to use more shallow redux objects which can really help performance.
Async is built in... so yeah
Here is a counter example using rematch 👉 https://snack.expo.io/#bacon/rematch-example notice how little code is used, there are also more features in this example than in the snack provided above.
It can be weird incorporating with react-navigation but Brent Vatne the dev currently working on react-navigation says you should avoid using redux with it anyways. 🤷♀️
I am not affiliated with Rematch even though this seems like a very bias review. 🌝
I think the packages that you could use in snack are limited. (https://forums.expo.io/t/modules-available-in-snack/1651)
But the limitation is changing real-time?
(https://forums.expo.io/t/adding-new-modules-to-expo-snack/1496/4)
For thouse who came here with this same problem, you can manually add it to the dependency list.
Go to package.json, at dependencies use the following format
"package": "version", you may want to chack the currently version of you package
ie:
"dependencies":{
"redux": "4.0.5",
"react-redux": "7.2.1",
}
You may have other dependencies before or after.
enter image description here
I tried to work with CPasswordHelper and everytime I got an exception when trying to run one of its methods. I think the reason is that I didn't import the package(system.utils) that CPasswordHelper is belong to. My question is how do I do that?
If it matter I'm working with netBeans.
CPasswordHelper is a core class defined in YiiBase, you don't need import it before using.
It is added since 1.1.14, may be you should check your yii version.
I'm currently experiencing a problem of architecting the application structure and its test infrastructure.
Here's a brief overview of the layout
<GOROOT>/src/myapp/controllers/
<GOROOT>/src/myapp/controllers/account.go
...
<GOROOT>/src/myapp/models/
<GOROOT>/src/myapp/models/account.go
<GOROOT>/src/myapp/models/account_test.go
...
<GOROOT>/src/myapp/components/
<GOROOT>/src/myapp/components/comp1/
<GOROOT>/src/myapp/components/comp1/impl.go
<GOROOT>/src/myapp/components/comp1/impl_test.go
<GOROOT>/src/myapp/components/
...
<GOROOT>/src/myapp/testutil/
<GOROOT>/src/myapp/testutil/database.go
<GOROOT>/src/myapp/testutil/models.go
...
Problem 1
File myapp/testutil/models.go contains some util functions used in the models/*_test.go tests.
The util functions actually do use the package myapp/models data structures and functions. Therefore we have an import cycle: account_test.go imports testutil package, which in its turn imports models.
The only clear solution here is to keep testutil/models.go right inside of models packages at the same package something like test_utils.go, which seems a bit clumsy to me. What would deb the best walkaround in such cases?
Problem 2
testutil package has some initialization of the comp1 (let's say it's a client to a 3rd party service). When we run a test comp1/impl_test.go the testutil package is imported, and it imports comp1 package as it's responsible for initialisation of the component. Same cyclic import hell. Moving initialisation to a every individual place in the test cases seems like a duplication of code. Still looking for some elegant solutions here...
Problem 1
If package testutils just provide utility functions used during testing of package module then just put those functions into models/testutils_test.go: Now these utility function will be included when running the models/*_test.go tests. No import cycle any longer.
This is your "only clear solution" and I cannot see anything "clumsy" with it.
Problem 2
Import cycle: Same as above.
Initialization: Your comp1/impl_test.go can provide a func init() so no need for duplicated code.
(The standard library is good source of how to test different stuff. IMHO code duplication in testing code is not one of the seven deadly sins.)