Tincan
Tincan
Explore posts from servers
NNuxt
Created by Tincan on 10/31/2024 in #❓・help
I'm using ZAP to security test my site, but request urls are chunks, any info on this please?
pls kapa
5 replies
NNuxt
Created by Tincan on 10/23/2024 in #❓・help
nuxt/eslint doesn't recognise global helpers in plugins folder
I have a number of files in my plugins folder and nuxt/eslint module is flagging the following as undefined, even though they're not and my project still works useRuntimeConfig, defineNuxtPlugin. A workaround is to add this to config, but it seems odd (a bug?) that it can't just read these in the plugins folder when it doesn't flag as a problem for the rest of the project languageOptions: { globals: { defineNuxtPlugin: "readonly", useRuntimeConfig: "readonly", }, },
10 replies
NNuxt
Created by Tincan on 10/23/2024 in #❓・help
(fixed) Cannot get esling.config.mjs to generate when installing eslint module
I'm trying to get the nuxt/eslint module working on my nuxt 3 project. I've installed and created the eslint.config.mjs file with contents as per the docs. As far as I can tell this file it references should be created when I install the module, but i cannot get it to
import withNuxt from "./.nuxt/eslint.config.mjs"

export default withNuxt()
import withNuxt from "./.nuxt/eslint.config.mjs"

export default withNuxt()
My package.json is as follows
{
"private": true,
"type": "module",
"scripts": {
"build": "nuxt build",
"dev": "nuxt dev",
"generate": "nuxt generate",
"preview": "nuxt preview",
"postinstall": "patch-package & nuxt prepare",
"lint": "eslint .",
"lintfix": "eslint . --fix",
"lintfixdry": "eslint . --fix-dry-run",
"format": "prettier . --write --ignore-unknown",
"prepare": "husky install",
"stylelint": "npx stylelint \"**/*.{css,scss,vue}\"",
"stylelintfix": "npx stylelint \"**/*.{css,scss,vue}\" --fix"
},
"devDependencies": {
"@nuxt/eslint": "^0.6.0",
"@nuxt/image": "^1.0.0",
"@nuxtjs/i18n": "^8.0.0-beta.10",
"@nuxtjs/stylelint-module": "^5.2.0",
"@nuxtjs/tailwindcss": "^6.6.0",
"@nuxtjs/turnstile": "^0.6.3",
"@types/markdown-it": "^12.2.3",
"@vueuse/core": "^9.13.0",
"@vueuse/nuxt": "^9.13.0",
"eslint": "^9.13.0",
"husky": "^8.0.3",
"lint-staged": "^15.2.0",
"markdown-it": "^13.0.1",
"nuxt": "^3.2.3",
"postcss-html": "^1.7.0",
"prettier": "^3.2.4",
"prettier-plugin-tailwindcss": "^0.5.11",
"sass": "^1.59.2",
"sass-loader": "^13.2.0",
"stylelint": "^16.10.0",
"stylelint-config-recommended-vue": "^1.5.0",
"stylelint-config-standard-scss": "^13.1.0",
"stylelint-config-tailwindcss": "^0.0.7",
"typescript": "^5.6.3"
},
...
}
{
"private": true,
"type": "module",
"scripts": {
"build": "nuxt build",
"dev": "nuxt dev",
"generate": "nuxt generate",
"preview": "nuxt preview",
"postinstall": "patch-package & nuxt prepare",
"lint": "eslint .",
"lintfix": "eslint . --fix",
"lintfixdry": "eslint . --fix-dry-run",
"format": "prettier . --write --ignore-unknown",
"prepare": "husky install",
"stylelint": "npx stylelint \"**/*.{css,scss,vue}\"",
"stylelintfix": "npx stylelint \"**/*.{css,scss,vue}\" --fix"
},
"devDependencies": {
"@nuxt/eslint": "^0.6.0",
"@nuxt/image": "^1.0.0",
"@nuxtjs/i18n": "^8.0.0-beta.10",
"@nuxtjs/stylelint-module": "^5.2.0",
"@nuxtjs/tailwindcss": "^6.6.0",
"@nuxtjs/turnstile": "^0.6.3",
"@types/markdown-it": "^12.2.3",
"@vueuse/core": "^9.13.0",
"@vueuse/nuxt": "^9.13.0",
"eslint": "^9.13.0",
"husky": "^8.0.3",
"lint-staged": "^15.2.0",
"markdown-it": "^13.0.1",
"nuxt": "^3.2.3",
"postcss-html": "^1.7.0",
"prettier": "^3.2.4",
"prettier-plugin-tailwindcss": "^0.5.11",
"sass": "^1.59.2",
"sass-loader": "^13.2.0",
"stylelint": "^16.10.0",
"stylelint-config-recommended-vue": "^1.5.0",
"stylelint-config-standard-scss": "^13.1.0",
"stylelint-config-tailwindcss": "^0.0.7",
"typescript": "^5.6.3"
},
...
}
versions eslint 9.13, nuxt/eslint 0.6.0, node v20.9.0 I've tried removing and adding the eslint related packages
11 replies
NNuxt
Created by Tincan on 4/30/2024 in #❓・help
Can't import the named export 'getCurrentInstance' in ./node_modules/vue-demi/lib/index.mjs
I'm trying to reverse engineer something in a nuxt 3 site for a nuxt 2 and I want to use intersectionObserver and windowSize from @vueuse/core, which I've installed version 5.3.0 which is the latest version still compatible with Vue 2. However I get this error still
ERROR in ./node_modules/vue-demi/lib/index.mjs

Can't import the named export 'getCurrentInstance' from non EcmaScript module (only default export is available)
ERROR in ./node_modules/vue-demi/lib/index.mjs

Can't import the named export 'getCurrentInstance' from non EcmaScript module (only default export is available)
I've tried the following fix in nuxt.config.js with no success
configureWebpack: {
module: {
rules: [
{
test: /\.mjs$/,
include: /node_modules/,
type: 'javascript/auto',
},
],
},
},
configureWebpack: {
module: {
rules: [
{
test: /\.mjs$/,
include: /node_modules/,
type: 'javascript/auto',
},
],
},
},
1 replies
NNuxt
Created by Tincan on 4/8/2024 in #❓・help
Service worker loaded by PWA causing constant reload
I have a service worker loaded by the @vite-pwa/nuxt plugin config in nuxt.config.ts which handles push notifications as well as offline install. This all works initially, but once loaded if I reset notification sin the browser this sometimes cause some issue where the site constantly reloads. Initially it says
workbox-b5f7729d.js:61 workbox Precaching 1 file.
workbox-b5f7729d.js:61 workbox Precaching 1 file.
But then when resetting notifications, in the console it says this and triggers a constant reload situation
workbox-b5f7729d.js:61 workbox Precaching 0 files. 1 file is already cached.
workbox-b5f7729d.js:61 workbox Precaching 0 files. 1 file is already cached.
Eventually it does seem to resolve itself (stop reloading) but is there a way I can stop it having to refresh so much - if the file is already cached, proceed rather than reload The config is
pwa: {
...
workbox: {
navigateFallback: "/",
importScripts: ['/offline-sw.js'],
},
devOptions: {
enabled: true,
type: "module",
},
},
pwa: {
...
workbox: {
navigateFallback: "/",
importScripts: ['/offline-sw.js'],
},
devOptions: {
enabled: true,
type: "module",
},
},
50 replies
NNuxt
Created by Tincan on 4/3/2024 in #❓・help
How to set meta theme-color in nuxt.config
app: {
head: {
...
meta: [{
theme_color: '#ffffff',
}],
},
},
app: {
head: {
...
meta: [{
theme_color: '#ffffff',
}],
},
},
Why isn't theme_color or theme-color valid? What can I set here?
35 replies
NNuxt
Created by Tincan on 3/27/2024 in #❓・help
Why isn't window.addeventListener working in plugin file?
// eslint-disable-next-line
export default defineNuxtPlugin((nuxtApp) => {
if ("serviceWorker" in navigator) {
console.log(" sw-register.js inside if")

window.addEventListener("load", () => {
console.log("sw-register.js inside addevent listener")

// try {
// await navigator.serviceWorker.register("/sw.js")
// console.log("Registered SW")
// } catch (error) {
// console.log(error)
// }
})
}
})
// eslint-disable-next-line
export default defineNuxtPlugin((nuxtApp) => {
if ("serviceWorker" in navigator) {
console.log(" sw-register.js inside if")

window.addEventListener("load", () => {
console.log("sw-register.js inside addevent listener")

// try {
// await navigator.serviceWorker.register("/sw.js")
// console.log("Registered SW")
// } catch (error) {
// console.log(error)
// }
})
}
})
I have this file sw-register.js being loaded as a plugin and I see the "inside if" console log, but not the "inside addevent listener". I have confirmed that window exists, but it does not appear to have the addEventListener function listed in the console. Any ideas?
4 replies