Activities

ducong123

ducong123 posted a new question

hare •

Unable to find native implementation, or alternative implementation for WebSocket!

Unable to find native implementation, or alternative implementation for WebSocket!

EmmanuelJego

EmmanuelJego posted a new question

hare •

"Uncaught ReferenceError: window is not defined" using client-side only plugin

Hi!

I first started a project with Vue.js, then I discovered Nuxt.js which seems very nice, so I started to recreate my project with Nuxt.
So I wanted to import the plugins I used in my Vue.js project (especially 'vue-pdf': https://www.npmjs.com/package/vue-pdf).

If, in my vue, I try to import it like "var pdfVue = require('vue-pdf')" I got a "Unexpected token <" error. This seems rigth since vue-pdf is a pdf player, so a client-side only component.

I tried to import it as a plugin like so (as it is written in the doc at https://nuxtjs.org/guide/plugins#client-side-only):
--> vue-pdf.js:
"
import Vue from 'vue'
import VuePdf from 'vue-pdf'

Vue.use(VuePdf)
"
--> nuxt.config.js:
"

plugins: [
{src: '~/plugins/vue-pdf.js', ssr: false}
],
build: {
vendor: [
'vue-pdf'
]
}

"
With that, I have a "Uncaught ReferenceError: window is not defined" error.
I also tried "{src: '~/plugins/vue-pdf.js', mode: 'client'}" but that doesn't change anything.

I don't even try to use/import the component in any vue.
I tried it in a brand new project to start from 0, but as soon as I create the plugin, I have the error.

Am I doing something wrong? Or is the plugin not working with Nuxt? I'm pretty confused!

Thanks for your help!

mjmnagy

mjmnagy posted a new question

hare •

Plugin registration

I am curious as to the methodology Nuxtjs uses to register a plugin. I have been reading the documentation for Nuxt.js and i am slightly confused as to the registration methodology.
I do not want to register plugins such as vue-flag-icon globally.
My understanding is when we register the plugin we use the plugin folder as such
import Vue from 'vue'
import FlagIcon from 'vue-flag-icon'
Vue.use(FlagIcon)
I can now use the flag component anywhere in my app - i dont want this!!!
I want to be able to load plugins into the components that need them ONLY.
i have tried loading them as a component like:
components:{
'flag': ()=> import('path to plugin') // @/plugins/vue-flag-icon
}
This does not work
I changed my plugins script to
import Vue from 'vue'
import FlagIcon from 'vue-flag-icon'
export default () => {
Vue.use(FlagIcon)
}
And then tried to register the plugin within the components like so:
import flag from '@/plugins/vue-flag-icon';
created(){
flag()
}
My questions really are:
How can i register a plugin within the component without importing the vue instance (i think is called a bus)
Is it bad practice to import the plugins directly into components
Is registering all the plugins within nuxt.config.js creating a larger download file for users to download( example: registering vue-twix is not necessary on pages that do not have textareas) or will nuxt/webpack handle the removal of unnecessary plugins on a page by page or component by component basis (so i dont have to even worry about this). If this is the case than i dig nuxt

parthibansettu

parthibansettu posted a new question

hare •

" Debugger listening on ws://127.0.0.1:1337/3a70b3dd-3378-4eae-8517-405e3ae9f3ba " browser not triggering while debugging

Node.js Version: 8.12.0
OS: Windows
Hi I am using Javascript with cucumber and i am trying to add debug feature in the framework using VScode and i am facing "C:\Program Files\nodejs\npm.cmd run-script debug
Debugger listening on ws://127.0.0.1:1337/3a70b3dd-3378-4eae-8517-405e3ae9f3ba"
When i click on "debug" browser is not triggered

Here is my launch.json file

{
// Use IntelliSense to learn about possible Node.js debug attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Debug",
"runtimeExecutable": "npm.cmd",
"cwd": "${workspaceRoot}/nodal/",
"env":{
"NODEPATH": "${workspaceRoot}/nodal/nodemodules"
},
"runtimeArgs": [
"run-script", "debug"
],
"port": 1337
}
]
}

Here is my package.json file
{
"name": "nodal",
"version": "1.1.5",
"description": "End to end UI test automation framework using node,es6,wdio and cucumber",
"main": "index.js",
"scripts": {
"test": "node nodemodules/webdriverio/bin/wdio ./config/runconf.js",
"suitetest": "node nodemodules/webdriverio/bin/wdio ./config/runconf.js --suite login",
"inspect-test": "node nodemodules/webdriverio/bin/wdio ./config/runconf.js --inspect",
"allure-report": "nodemodules/.bin/allure generate ./reports/allure-results -c && allure open", "test1": "npm run test && npm run allure-report", "junit-report": "nodemodules/.bin/junit-viewer --results=./reports/junit-results --save=junit-results.html && open junit-results.html",
"build": "babel featuregenerator/server.js", "start-feature": "nodemon featuregenerator/server.js --exec babel-node",
"start-runner": "nodemon testrunnerandreportgenerator/server.js --exec babel-node",
"debug": "node --inspect=1337 --debug-brk --nolazy nodemodules/cucumber/bin/cucumber-js --tags @debug --format json:./reports/report.json" }, "author": "TAA", "license": "AthenaHealth", "dependencies": { "4": "0.0.0", "@athena/app-fabric-logger": "^3.0.0", "@athena/iam-service-token-manager": "^1.1.1", "@sinonjs/formatio": "^3.2.1", "allure-commandline": "^2.5.0", "assert": "^1.5.0", "axios": "^0.18.0", "babel-cli": "^6.26.0", "babel-polyfill": "^6.26.0", "babel-preset-env": "^1.6.0", "babel-preset-es2015": "^6.24.1", "babel-register": "^6.26.0", "body-parser": "^1.19.0", "cookie-parser": "^1.4.3", "cucumber": "^5.0.2", "date-time": "^2.1.0", "express": "^4.16.4", "graceful-fs": "^4.1.11", "hoek": "^6.1.3", "js-yaml": "^3.13.1", "json-to-pretty-yaml": "^1.2.2", "json2yaml": "^1.1.0", "multer": "^1.4.1", "node-yaml": "^3.2.0", "opn": "^5.5.0", "qs": "^6.7.0", "random-string-generator": "^0.2.0", "regex": "^0.1.1", "replace-ext": "1.0", "rgb-hex": "^2.1.0", "rgba-convert": "^0.3.0", "selenium-grid": "^0.5.0", "tar": "^4.4.6", "wdio-allure-reporter": "^0.6.0", "wdio-dot-reporter": "0.0.5", "wdio-json-reporter": "^0.1.1", "wdio-junit-reporter": "0.0.2", "wdio-spec-reporter": "^0.1.2", "yawn-yaml": "^1.4.0" }, "devDependencies": { "chromedriver": "^2.42.0", "eslint": "^5.16.0", "eslint-config-standard": "^10.2.1", "eslint-plugin-import": "^2.17.2", "eslint-plugin-node": "^5.1.1", "eslint-plugin-promise": "^3.5.0", "eslint-plugin-react": "^3.16.1", "eslint-plugin-standard": "^3.0.1", "inspect-brk": "^0.1.2", "node-cmd": "^3.0.0", "node-dir": "^0.1.17", "node-uuid": "^1.4.7", "nodemon": "^1.19.0", "open": "^6.3.0", "selenium-standalone": "^6.16.0", "wdio-chromedriver-service": "~0.1", "wdio-cucumber-framework": "^1.1.1", "wdio-screenshot": "^0.5.0", "wdio-selenium-standalone-service": "^0.0.10", "webdriverio": "4.13.2" }, "babel": { "presets": [ [ "env", { "targets": { "node": "current" } } ] ], "plugins": [ "transform-object-rest-spread" ] }, "nodemonConfig": { "ignore": [ "./config", "./reports", "./allure-report", "./pageobjects",
"./step_definitions"
]
}
}
can you tell me how to fix this issue ?

AlexBa

AlexBa posted a new bug report

hare •

bug Wrong routes with /_nuxt/ prefix in sitemap

Version

v0.4.0

Reproduction link

https://alexanderbarton.de/sitemap.xml

Steps to reproduce

Just generate the sitemap with the config. :)

What is expected ?

Routes in sitemap without the /_nuxt/ prefix

What is actually happening?

Routes in sitemap with /_nuxt/ prefix

Additional comments?

This is my nuxt.config.js:

const pkg = require('./package');
const dotenv = require('dotenv');

dotenv.config();

module.exports = {
mode: 'universal',

/*
** Headers of the page
*/
head: {
title: pkg.name,
meta: [
{ charset: 'utf-8' },
{ name: 'viewport', content: 'width=device-width, initial-scale=1' },
{ hid: 'description', name: 'description', content: pkg.description }
],
link: [
{ rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' },
]
},

/*
** Customize the progress-bar color
*/
loading: false,

/*
** Global CSS
*/
css: [
'~assets/scss/style.scss',
],

/*
** Plugins to load before mounting the App
*/
plugins: [
{src: '~plugins/bootstrap-native', ssr: false},
{src: '~plugins/tiny-slider', ssr: false}
],

/*
** Nuxt.js modules
*/
modules: [
'@nuxtjs/dotenv',
'@nuxtjs/axios',
'@nuxtjs/redirect-module',
['@nuxtjs/google-tag-manager', {
id: process.env.GTMCONTAINERID
}],
['nuxt-i18n', {
strategy: 'prefixexceptdefault',
defaultLocale: 'de',
lazy: true,
langDir: 'translations/',
locales: [
{
code: 'de',
file: 'de.json'
}
],
}],
'@nuxtjs/sitemap'
],

axios: {
// proxyHeaders: false
},

redirect: [
{ from: '^/datenschutz-erklaerung', to: '/datenschutz' }
],

/*
** Build configuration
*/
build: {
extend(config) {
config.module.rules.push({
test: /bootstrap.native/,
use: {
loader: 'bootstrap.native-loader',
options: {
only: ['collapse', 'modal']
}
}
});
}
}
};

Lisiadito

Lisiadito posted a new bug report

hare •

bug import of type for JSONValue missing

Version

v0.1.1

Reproduction link

https://github.com/nuxt/http/blob/dev/types/index.d.ts

Steps to reproduce

Using the @nuxt/http module with TypeScript leads to an error Cannot find name 'JSONValue'

What is expected ?

Compilation works without problems

What is actually happening?

Error Cannot find name 'JSONValue' because the type is used but not imported

joergac

joergac posted a new question

hare •

Is this package abandoned?

I am actually considering using this package but it seems like it's been abandoned from the maintainers? That are many PRs that haven't been addressed at all and half the issues have not been answered.

I am not criticizing the work here and I respect that this is a community package. I am just asking if this is considered to be just that or if it is under active development..

shahzaibanwar009

shahzaibanwar009 posted a new question

hare •

config with miniToaster in nuxt app

config with miniToaster in nuxt app
I installed vue-notification plugin and configured it.it is working fine
i wanna add mini-toaster how to setup mini-toaster

seybsen

seybsen posted a new question

hare •

[deleted]

[deleted]

alanaasmaa

alanaasmaa posted a new feature request

hare •

idea Refresh page on when clicking same page router link.

What problem does this feature solve?

Hello,

I have tried to fight with this issue couple of times for now.

I have a page running on default layout.
The page contains a form that will switch form with success page after filling.

Sometimes users would like to refresh the page by clicking the logo/router-link.

But when current page is active the router wont refresh the page.
How could i do that?

I have tried to add :key to everywhere.
I found this but not working => https://github.com/nuxt/nuxt.js/issues/2285

What does the proposed changes look like?

I think it would be good to have a option for template. That by default wont allow refreshing/reloading and when re clicking it reloads.

RafaelGSS

RafaelGSS posted a new question

hare •

meanmenu + nuxtjs

Hello everyone.

I would like use meanmenu jQuery on my application NuxtJS. But, i don't understanding how to work the plugins.

I trying like bellow:

nuxt.config.js

plugins:[
      '~plugins/meanmenu-import'
    ]

plugins/meanmenu-import.js

import Vue from 'vue'

import * as js from 'meanmenu.js'

Vue.use(js);

plugins/meanmenu.js

The raw content of: https://github.com/meanthemes/meanMenu/blob/master/jquery.meanmenu.js

Just copy paste.

--

I using on content like:

export default {
    mounted() {

     /* jQuery MeanMenu */
    $('#mobile-menu-active').meanmenu({
        meanScreenWidth: "991",
        meanMenuContainer: ".mobile-menu-area .mobile-menu",
    });

    }
}

And receive the error:

$(...).meanmenu is not a function
JasonGaoG

JasonGaoG posted a new question

hare •

Have no Ant Design Vue choice when I use create-nuxt-app to init project

I don't have Ant Design Vue UI framework choice when I use create-nuxt-app to init project, Below is the choice list:
? Use a custom UI framework
none
bootstrap
vuetify
bulma
tailwind
element-ui
buefy

Hxmic

Hxmic posted a new question

hare •

Upgrade error

Hello everyone .My project upgrade 1.0 to 2.0, According to this steps , first I delete node_modules .nuxt.js and package-lock.json, then npm upgrade , npm install finally npm run dev,

This is new error

in ./.nuxt/client.js friendly-errors 19:45:27

Module build failed (from ./nodemodules/@nuxt/webpack/nodemodules/babel-loader/lib/index.js): friendly-errors 19:45:27
Error: Plugin/Preset files are not allowed to export objects, only functions.

msymms

msymms posted a new question

hare •

Accessing store in js plugin

I have reviewed the comments in c6898 and still am a little confused. I have an asyncData call in nuxtServerInit loading an array and storing in the store. I have code that needs to be run in four separate components and wanted to combine this into a plugin/mixin. However, this code (which of course works fine in the component locally) requires access to the store. I get an error stating the prop 'getters' is undefined. Here is the js code for the methods/mixin.

util.js

getCategories (categories) {
    const loadedCategories = this.$store.getters.loadedCategories;
    let categoryNames = [];
    for (let idx in loadedCategories) {
      for (let cIdx in categories) {
        if (loadedCategories[idx].uuid === categories[cIdx]) {
          categoryNames.push(loadedCategories[idx].name);
          console.log(loadedCategories[idx].name);
        }
      }
    }
    return categoryNames;
  }

plugin code (main.js)

import Vue from 'vue'
import util from '~/static/js/util.js'

Vue.mixin({
  methods: {
    listCategories(categories) {
      util.getCategories(categories)
    }
  }
})

Again, I load the required array in the nuxtServerInit action and commit it to the store

Is the store available at this stage of the lifecycle??

TIA

podlebar

podlebar posted a new bug report

hare •

bug PWA Icon Module is generating false output

Version

2.6.0

Reproduction link

https://gist.github.com/podlebar/c3199368b0ff026d0454e2c77115297f

Steps to reproduce

Install nuxt pwa module as described in the docs. Add a 512px icon.png to static folder.

What is expected ?

icon prop should be array without size

What is actually happening?

the icon prop gets the size of the icons array passed. mainfest.json is not valid anymore

brandonpittman

brandonpittman posted a new bug report

hare •

bug Nuxtent cannot load pages when @nuxtjs/axios is registered as a module

Version

v0.4.0

Reproduction link

https://github.com/brandonpittman/nuxtent-module/blob/master/examples/multiple-content-types/nuxt.config.js

Steps to reproduce

Add '@nuxtjs/axios' to nuxt.config.js

What is expected ?

Should display content files

What is actually happening?

Can't find page

aaaguirrep

aaaguirrep posted a new question

hare •

Best practice to load all information of users after the authentication process

Hi, i am not a developer but i am deploying a web application using nuxt and i have a doubt about load all information related to the users once in the application, all the information is managed by vuex. I need to load all information after the authentication process because i am showing a dashboard to the user. I have read and found the next options but i don't know where is the best practice without impact the performance of the application:

1.- Load all information in the same vuex action where the user authenticates. I have an action to validate the user and password and it creates the cookies and token sessions. I can load all information in the same action but the authentication process could be slower. With this option the load of information is executed just once.

2.- Load all information in the main/dashboard component by the fetch function consuming an vuex action (do a dispatch). It works but i am seeing that when i browse to the main/dashboard component the fetch function is always appearing. Load of information should be once after the authentication process.

3.- I also am using the nuxtserverinit to load all information when the users press F5 button or reload the web application but if i do a reload in the main/dashboard component i am seeing nuxtserverinit and fetch functions . I am duplicating resources.

I really appreciate your help.

Thanks in advance.

Regards,
Arsenio

nathanchase

nathanchase posted a new feature request

hare •

idea Add function to nuxt.config that passes current instance to enable access to URL path

What problem does this feature solve?

I want to try to add a canonical URL declaration like so:

link: [
    { rel: 'canonical', href: `https://www.mysite.com/${this.$route.path}` },
],

but it doesn't seem that there's anyway to access this.$route from within nuxt.config

@manniL suggested in Discord that creating a function that passes the current instance would enable this.

Having a single place in the config to declare a canonical URL structure would prevent having to declare it on every individual page component.

What does the proposed changes look like?

Add a function to nuxt.config to allow access to the router (path).

Perhaps something like this.$instance.$route.path ?

Modcat

Modcat posted a new question

hare •

Babel

IE11 support I have followed the docs on the page…

https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/babel-preset-app

However, Babel is not poly filling or transpiling for example parameters with default values such as…

function( param = 0 ) { …

…Transpiled to…

function( param ) { param = param || 0

I have this in my package.json

"browserslist": [
"> 0%",
"last 2 versions",
"IE 10"
],

I have this in my nuxt.config.js at the top

import '@babel/polyfill'

THEN under build, I've added the babel key

babel: {
presets: [
[
'@nuxtjs/babel-preset-app',
{
useBuiltIns: 'entry',
targets: { ie: 11 }
}
]
]
}

It does not transpile at all, still have erros and no poly filling.

begueradj

begueradj posted a new bug report

hare •

bug baseURL does not take effect

Version

v0.4.0

Reproduction link

https://github.com/begueradj/nuxt-axios-baseurl-bug

Steps to reproduce

  1. Clone my repo and change to the resulted directory
  2. Intall the dependencites: yarn install
  3. Launch the server: yarn run dev

What is expected ?

I expect the number of displayed posts to be 100.

This means in pages/index.vue, when I have this code:

mounted() {
    axios.get('/posts')
    .then(response => {
      this.posts = response.data
    })
    .catch(e => {
      this.errors.push(e)
    })
  }

axios should recoginize the baseURL configuration key I set in nuxt.config.js and thus fetch data from http://jsonplaceholder.typicode.com/posts

Here is my nuxt.config.js file content related to axios module:

modules: [
    // Doc: https://github.com/nuxt-community/axios-module#usage
    ['@nuxtjs/axios', {
      baseURL: 'http://jsonplaceholder.typicode.com'
    }]
  ],
  /*
  ** Axios module configuration
  */
  axios: {
    // See https://github.com/nuxt-community/axios-module#options
  },

What is actually happening?

The number of displayed posts is 0
axios is trying to send a get request to http://localhost/posts instead of http://jsonplaceholder.typicode.com/posts

Additional comments?

I checked similar posts but nothing worked for me.

Thanks,
Billal Begueradj