If I add Angular 2 repository as a dependency in my project:
npm install https://github.com/angular/angular.git
then I cannot resolve my imports. For instance:
import {Component} from '#angular/core';
will return:
Cannot find module '#angular/core'
Is there any clean and handy way to use a Github checkout of Angular 2 in my project?
Related
I have already installed the library https://github.com/jerosoler/Drawflow by npm from the repository and it is installed
npm i drawflow
but I try to import it to my component in DrawNode.vue and it gives me an error:
import Drawflow from '../../node_modules/drawflow/dist/drawflow.js';
or in this way but it does not find the packages
import Drawflow from 'drawflow'
import styleDrawflow from 'drawflow/dist/drawflow.min.css'
but this way it doesn't find the package in node_modules
I tried to import in main.js but I don't know how to get the data to my component.
repository of my code https://github.com/RobinCC95/drawFlow.git
I want to use tailwind typeahead vue plugin in nuxt. i have added the package using npm install vue-tailwindcss-typeahead .
then i created a file in plugins folder. tailwind-typeahead.js with following code
import Vue from 'vue'
import VueTailwindcssTypeahead from 'vue-tailwindcsscss-typeahead'
Vue.use(VueTailwindcssTypeahead)
and included the plugin file in nuxt.config.js
{ src: './plugins/tailwind-typeahead.js' }
But i am getting this error
This dependency was not found: friendly-errors 01:44:37
friendly-errors 01:44:37
* vue-tailwindcsscss-typeahead in ./plugins/tailwind-typeahead.js friendly-errors 01:44:37
friendly-errors 01:44:37
To install it, you can run: npm install --save vue-tailwindcsscss-typeahead
for reference here is the link of package
https://github.com/basarozcan/vue-tailwindcss-typeahead
You do have a typo in your plugin: vue-tailwindcsscss-typeahead.
You probably meant to write vue-tailwindcss-typeahead .
The rest is fine and it's the way to go if you want your code to be globally available in your Nuxt app. If you only want it local, import it in the component itself.
How can I see if a Vue project has been created with vue-cli 2 or vue-cli 3?
Currently I have the problem that I have to import Vue like that:
import Vue from 'vue/dist/vue.js'
instead of
import Vue from 'vue'
Someone asked me how I started the project and I can not remember if it was vue-cli 2 or 3
The Vue-CLI is the command line interface, not the package that you use in your application. To discover which version you've used, run this command on the terminal:
$ vue --version
It will show something like below:
[youruser#youcomputer ~]$ vue --version
2.9.6
I'm quite new in Vue and maybe my issue is trivial.
What I have to do:
I want to create a Vue component that I can put in a NPM private repo and import it into other projects with a sth like bundle.js file
TLDR:
can't import vue component building by vue-cli-service build --target lib/wc. Importing component I have sth silimar to "export 'HelloWorld' was not found in '../node_modules/hello-world'
long version:
I have asked questions and projects as much as I could. All projects are built by vue-cli without any additional changes.
create new default project vue create hello-world
by default we havefirst component here - src/component/HelloWorld, and for this example this is component which we want to export
using vue-cli-service try to make exportable file.
3a. vue-cli-service build --target lib --name vue-test ./src/components/index.js where index.js is
import Vue from 'vue';
import HelloWorld from './HelloWorld.vue';
const Components = {
HelloWorld,
};
Object.keys(Components).forEach((name) => {
Vue.component(name, Components[name]);
});
export default Components;
3b. or directly vue file vue-cli-service build --target wc --name vue-test 'src/components/HelloWorld.vue'
in both scenarios vue-cli-service generates me file in to /dist folder and I want to believe this file are correct
in both scenarios I can't import this component to another vue project using import {HelloWorld} from 'path/to/folder/or/file'; or require('path/to/folder/or/file'). It seems like bundle files haven't exported member.
what I doing wrong? Should use build --target wc or build --target lib?
If You don't want to create new app to reproduce this issue U can download repo from https://github.com/okosowski/vueTest (project started using vue cli).
git clone
npm install
npm run build-bundle-lib or npm run build-bundle-lib
npm link or simply copy file to exiting vue project
try to import/display HelloWorld
I will be grateful for any help!!!
thanks
node v10.14.2
npm 6.4.1
vue-Cli 2.9.6 (the same on 3.3.0)
other used version in https://github.com/okosowski/vueTest/blob/master/package.json
I was facing the same exact problem while using vue-cli to build and test my Vue component. Fortunately I was able to find the solution after reporting it as a bug to vue-cli issue tracker on GitHub. Turned out there was nothing wrong with the common.js file nor was it a bug.
Anyway... long story short, the existing project you are trying to import into is unable to resolve symlinks (because this is what happens when you use npm link). In order to solve your problem, you need to add the following into vue.config.js in the root folder of the project you are importing into:
// vue.config.js
module.exports = {
chainWebpack: config => config.resolve.set('symlinks', false)
}
Hope this helps. For more info, check out these links:
My issue report in the vue-cli tracker
Webpack configuration: resolve.symlinks
how to integrate dygraphs library in Vuejs webapp
i used npm wrapper for integration :
npm install --save vue-dygraphs
and then using:
import Vue from 'vue'
import VueDygraphs from 'vue-dygraphs'
Vue.use(VueDygraphs)
but i don't know how to integrate them for required graphs in Vuejs