Vuepress multiple sidebar don't show all items - vue.js

I'm learning about vuepress and i'm trouble to config the sidbar.
Description
Following the docs I replicated the multiple-sidebar configuration without success.
Only the first path it is showed. What am i doing worg?
My config js:
module.exports = {
title: "Jhonatan Morais",
description: "Welcome to my documentation site",
editLinks: true,
smoothScroll: true,
themeConfig: {
sidebar: {
"/foo/": ["", "one"],
"/bar/": ["", "three"],
// fallback
"/": ["" /* / */],
},
},
postcss: {
plugins: [require("autoprefixer"), require("tailwindcss")("./tailwind.js")],
},
};
My project organization
My render results from yarn docs:dev
Some others details
If i browse the pages by url they are there
Here is my system info:
Environment Info:
System:
OS: Windows
CPU: (8) x64 Intel(R) Core(TM) i7-4770 CPU # 3.40GHz
Binaries:
Node: 10.16.2 - C:\Users\JHONAT~1.MOR\AppData\Local\Temp\yarn--1593443655966-0.6783257365479927\node.CMD
Yarn: 1.22.4 - C:\Users\JHONAT~1.MOR\AppData\Local\Temp\yarn--1593443655966-0.6783257365479927\yarn.CMD
npm: 6.9.0 - C:\Program Files\nodejs\npm.CMD
npmPackages:
#vuepress/core: 1.5.2
#vuepress/theme-default: 1.5.2
vuepress: ^1.5.2 => 1.5.2
npmGlobalPackages:
vuepress: Not Found

I believe this is working as designed. You will only see the /foo/ sidebar when the route starts with /foo/. So, you won't see the /bar/ sidebar until you go to a route/page that starts with /bar/. You may want to use Sidebar Groups if you want to group links together in a single sidebar that is displayed for every route.

Related

Vue i18n : Pluralization and Linked Messages not interpreted in production

I've managed to integrate nicely the vue-i18n library on my development environment and it works perfectly.
However, when I deploy the project on Heroku, every message using vue-i18n Pluralization or Linked Locale Messages is not being interpreted and shows the entire locale message string :
I've opened a discussion on the repo but no reply so far...
I am using vue-i18n (9.2.2) in a Nuxt3 plugin, therefore using VueJS 3, building with Vite with the plugin for vue-i18n vite-plugin-vue-i18n.
Nuxt3 configuration (nuxt.config.ts), showing the Vite plugin config to resolve the locales JSON files :
import { defineNuxtConfig } from 'nuxt'
import { resolve, dirname } from 'node:path'
import { fileURLToPath } from 'url'
import VueI18nVitePlugin from '#intlify/unplugin-vue-i18n/vite'
export default defineNuxtConfig({
...
vite: {
plugins: [
VueI18nVitePlugin({
include: [
resolve(dirname(fileURLToPath(import.meta.url)), './locales/*.json')
]
})
]
},
...
});
Nuxt plugin for vue-i18n (plugins/vue-i18n.ts) :
import { createI18n } from 'vue-i18n'
import fr from '~/locales/fr.json'
import en from '~/locales/en.json'
// DOC I18N : https://www.i18next.com/translation-function/essentials
export default defineNuxtPlugin(({ vueApp }) => {
const i18n = createI18n({
legacy: false,
allowComposition: true,
globalInjection: true,
locale: 'fr',
fallbackLocale: 'en',
messages: {
'en': en,
'fr': fr,
}
});
vueApp.use(i18n);
})
And here are the 2 locales files :
locales/fr.json :
{
"test": "Zero test | Un test | {n} tests",
"testnested": {
"nestedvalue": "Zero sous-test | Un sous-test | {n} sous-tests"
},
...
locales/en.json :
"test": "Zero test | One test | {n} tests",
"testnested": {
"nestedvalue": "Zero sub-test | Un sub-test | {n} sub-tests"
},
...
}
Example of how the locale messages are used within the Vue templates :
<p>
-- TEST ROOT --<br />
{{ $t('test', 0) }}<br />
{{ $t('test', 1) }}<br />
{{ $t('test', 2) }}<br />
<br />
-- TEST NESTED --<br />
{{ $t('testnested.nestedvalue', 0) }}<br />
{{ $t('testnested.nestedvalue', 1) }}<br />
{{ $t('testnested.nestedvalue', 2) }}<br />
</p>
The Plurals and Linked messages syntax in the locales messages should be interpreted by vue-i18n and not display the full locale message string.
[EXPECTED] Local environment output :
[BUG RESULT] Same code packaged for production, deployed on Heroku :
Another example with failing Linked Messages (in production) :
Here are some infos about my system :
System:
OS: Windows 10 10.0.22000
CPU: (8) x64 Intel(R) Core(TM) i7-1065G7 CPU # 1.30GHz
Memory: 16.35 GB / 31.59 GB
Binaries:
Node: 16.13.2 - C:\Program Files\nodejs\node.EXE
Yarn: 1.22.17 - C:\Program Files\nodejs\yarn.CMD
npm: 8.1.2 - C:\Program Files\nodejs\npm.CMD
Browsers:
Edge: Spartan (44.22000.120.0),
Chromium (105.0.1343.27)
Internet Explorer: 11.0.22000.120
npmPackages:
#intlify/unplugin-vue-i18n: ^0.5.0 => 0.5.0
vitest: ^0.20.3 => 0.20.3
vue-i18n: ^9.2.2 => 9.2.2
vue-toastification: next => 2.0.0-rc.5
I have read on other threads and on StackOverflow here but the accepted answer doesn't seem to be up-to-date, and believe there could be issues with the way webpack or vite are packaging the project.
What am I doing wrong here ?
If nothing seems wrong, would you recommend I open a bug report on vue-i18n repo ? Or on the #intlify/vite-plugin-vue-i18n repository ?
I had the same problem.
Think this is an issue with the vite-plugin-vue-i18n pre-compile which converts messages to JS functions. I set runtimeOnly:false in vite.config.js and it then worked the same in Production as in HMR.

HMR doesn't work since the vue cli plugins update (v5)

Version
5.0.1
Reproduction link
github.com
Environment info
Environment Info:
System:
OS: Linux 5.13 Ubuntu 20.04.4 LTS (Focal Fossa)
CPU: (12) x64 Intel(R) Core(TM) i7-8700K CPU # 3.70GHz
Binaries:
Node: 14.17.1 - ~/.nvm/versions/node/v14.17.1/bin/node
Yarn: 1.22.17 - /usr/bin/yarn
npm: 6.14.13 - ~/.nvm/versions/node/v14.17.1/bin/npm
Browsers:
Chrome: 98.0.4758.102
Firefox: 97.0
npmPackages:
#gtm-support/vue-gtm: ^1.3.0 => 1.3.0
#intlify/eslint-plugin-vue-i18n: ^1.2.0 => 1.2.0
#intlify/vue-devtools: 9.2.0-beta.22
#vue/apollo-option: ^4.0.0-alpha.15 => 4.0.0-alpha.15
#vue/babel-helper-vue-jsx-merge-props: 1.2.1
#vue/babel-helper-vue-transform-on: 1.0.2
#vue/babel-plugin-jsx: 1.1.1
#vue/babel-plugin-transform-vue-jsx: 1.2.1
#vue/babel-preset-app: 5.0.1
#vue/babel-preset-jsx: 1.2.4
#vue/babel-sugar-composition-api-inject-h: 1.2.1
#vue/babel-sugar-composition-api-render-instance: 1.2.4
#vue/babel-sugar-functional-vue: 1.2.2
#vue/babel-sugar-inject-h: 1.2.2
#vue/babel-sugar-v-model: 1.2.3
#vue/babel-sugar-v-on: 1.2.3
#vue/cli-overlay: 5.0.1
#vue/cli-plugin-babel: ^5.0.1 => 5.0.1
#vue/cli-plugin-eslint: ^5.0.1 => 5.0.1
#vue/cli-plugin-router: 5.0.1
#vue/cli-plugin-typescript: ^5.0.1 => 5.0.1
#vue/cli-plugin-unit-jest: ^5.0.1 => 5.0.1
#vue/cli-plugin-vuex: 5.0.1
#vue/cli-service: ^5.0.1 => 5.0.1
#vue/cli-shared-utils: 5.0.1
#vue/compiler-core: 3.2.30
#vue/compiler-dom: 3.2.30
#vue/compiler-sfc: 3.2.30
#vue/compiler-ssr: 3.2.30
#vue/component-compiler-utils: 3.3.0
#vue/devtools-api: 6.0.0-beta.20.1
#vue/eslint-config-airbnb: ^5.3.0 => 5.3.0
#vue/eslint-config-typescript: ^7.0.0 => 7.0.0
#vue/reactivity: 3.2.30 (3.2.31)
#vue/reactivity-transform: 3.2.30
#vue/runtime-core: 3.2.30 (3.2.31)
#vue/runtime-dom: 3.2.30 (3.2.31)
#vue/server-renderer: 3.2.30
#vue/shared: 3.2.30 (3.2.31)
#vue/test-utils: ^2.0.0-rc.18 => 2.0.0-rc.18
#vue/vue3-jest: ^27.0.0-alpha.4 => 27.0.0-alpha.4
#vue/web-component-wrapper: 1.3.0
eslint-plugin-vue: ^7.17.0 => 7.17.0
eslint-plugin-vue-scoped-css: ^1.3.0 => 1.3.0
floating-vue: ^2.0.0-beta.1 => 2.0.0-beta.1
jest-serializer-vue: 2.0.2
jest-serializer-vue-tjw: ^3.19.0 => 3.19.0
stylelint-config-recommended-vue: ^1.2.0 => 1.2.0
typescript: ^4.4.2 => 4.4.2
vue: ^3.2.30 => 3.2.30
vue-apollo: ^3.0.7 => 3.0.7
vue-chart-3: ^3.1.1 => 3.1.1
vue-cli-plugin-webpack-bundle-analyzer: ~4.0.0 => 4.0.0
vue-composition-test-utils: ^1.0.3 => 1.0.3
vue-ctk-date-time-picker3: ^2.5.2 => 2.5.2
vue-demi: 0.4.5 (0.12.1)
vue-eslint-parser: 7.10.0 (8.0.1)
vue-hot-reload-api: 2.3.4
vue-i18n: ^9.2.0-beta.22 => 9.2.0-beta.22
vue-loader: 17.0.0 (15.9.8)
vue-resize: 2.0.0-alpha.1
vue-router: ^4.0.12 => 4.0.12
vue-style-loader: 4.1.3
vue-template-es2015-compiler: 1.9.1
npmGlobalPackages:
#vue/cli: 5.0.1
Steps to reproduce
HMR/Hot-reload doesn't work and in the console errors such as "The connection to wss://custom-url:8080/ws was interrupted while the page was loading.." will be thrown constantly. So something must be wrong with the devServer setup but I've tried many different setups and couldn't find a working one.
When I change anything in the templates I usually get similar errors such as:
Uncaught TypeError: can't access property "./node_modules/babel-loader/lib/index.js??clonedRuleSet-40.use[0]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./src/views/Suppliers/Suppliers.vue?vue&type=script&lang=js", currentUpdate is undefined
What is expected?
HMR should work as it was before changing to the v5 plugins
What is actually happening?
HMR doesn't work, my changes are only visible if I reload the page
This is about an old vue 2.6.x project being migrated to vue 3 completely. Unfortunately it is about a monolith app so a complete reproduction wasn't possible, but I hope that posting all config files may be enough to find out the problem. If you need any other config files or anything else to help debug please let me know.
I see an error in the terminal as well:
Proxy error: Could not proxy request /app.e9978b73a5a9070c.hot-update.json from CUSTOM-URL:8080 to https://CUSTOM-URL/. See https://nodejs.org/api/errors.html#errors_common_system_errors for more information (ECONNRESET).
Thanks for you help in advance!
My team could fix it by adding the optimization object to our webpack config (in vue.config.js):
const { defineConfig } = require('#vue/cli-service');
module.exports = defineConfig({
/* your config */
configureWebpack: {
optimization: {
runtimeChunk: 'single',
},
},
devServer: {
proxy: `https://${process.env.SANDBOX_HOSTNAME}/`, // we need this for apollo to work properly
host: '0.0.0.0',
allowedHosts: 'all',
},
});
It fixed the HMR for us, however if you're using firefox your console might be still spammed by error messages like these: The connection to wss://SANDBOX_HOSTNAME:8080/ws was interrupted while the page was loading.

React Native - Failed to parse declaration in styled-components

The same approach using stylesheet works normally
Environment
System:
OS: macOS 11.6
CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU # 2.60GHz
Memory: 1.03 GB / 16.00 GB
Shell: 5.8 - /bin/zsh
Binaries:
Node: 16.6.0 - ~/.nvm/versions/node/v16.6.0/bin/node
Yarn: 1.22.11 - ~/.nvm/versions/node/v16.6.0/bin/yarn
npm: 6.14.4 - ~/Projects/design-system/typography/node_modules/.bin/npm
Watchman: 2021.09.13.00 - /usr/local/bin/watchman
npmPackages:
styled-components: 5.1.0 => 5.1.0
Reproduction
import React from 'react';
import styled from 'styled-components/native';
import { View } from 'react-native';
const CustomText = styled.Text(({ theme }) => ({
fontFamily: 'Zapf Humanist 601',
}));
export default App = () => (
<View>
<CustomText>Your Text<CustomText>
</View>
);
Steps to reproduce
Copy ZapfHumanist601BT-Roman.ttf in your fonts folder (./src/assets/fonts)
Make a link font using npx react-native link
Apply a linked font in your text component
Expected Behavior
The font is expected to be applied in the style
Actual Behavior
Error: Failed to parse declaration "fontFamily: Zapf Humanist 601"
The font-weight property will not work fine in this situation.
You can put your fonts in src/assets/fonts directory:
src
|_ assets
|_ Montserrat-Bold.ttf
|_ Montserrat-Regular.ttf
// and so on for the rest of fonts file
And define the assets properties in the react-native.config.js file which is at the root of your project in this way:
module.exports = {
project: {
ios: {},
android: {},
},
assets: ['./src/assets/fonts/'],
};
Now, you can use the fonts in the styles like this (without define the weight property):
title : {
fontFamily: Montserrat-Regular
}

ERROR #98123 WEBPACK: Generating development JavaScript bundle failed - unexpected token

I have cloned my repository an then install all packages via npm. When i try to start mu program with gatsby develop i get this error in all files in templates directory.
I've already cleared chache, deleted node_modules and public folders, re-install packages and so on, but nothing worked.
This is is info, which I get from gatsby info:
System:
OS: macOS 11.1
CPU: (4) x64 Intel(R) Core(TM) i5-7360U CPU # 2.30GHz
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 14.0.0 - ~/.nvm/versions/node/v14.0.0/bin/node
Yarn: 1.13.0 - ~/.npm-global/bin/yarn
npm: 6.14.4 - ~/.nvm/versions/node/v14.0.0/bin/npm
Languages:
Python: 2.7.16 - /usr/bin/python
Browsers:
Chrome: 87.0.4280.141
Firefox: 78.0.2
Safari: 14.0.2
npmPackages:
gatsby: ^2.30.1 => 2.31.1
gatsby-awesome-pagination: ^0.3.6 => 0.3.6
gatsby-image: ^2.5.0 => 2.10.0
gatsby-plugin-eslint: ^2.0.8 => 2.0.8
gatsby-plugin-fontawesome-css: ^1.0.0 => 1.0.0
gatsby-plugin-manifest: ^2.6.1 => 2.11.0
gatsby-plugin-netlify-cms: ^4.5.0 => 4.9.0
gatsby-plugin-offline: ^3.4.0 => 3.9.0
gatsby-plugin-react-helmet: ^3.4.0 => 3.9.0
gatsby-plugin-sharp: ^2.8.0 => 2.13.1
gatsby-plugin-styled-components: ^3.5.0 => 3.9.0
gatsby-plugin-typography: ^2.10.0 => 2.11.0
gatsby-source-filesystem: ^2.5.0 => 2.10.0
gatsby-transformer-remark: ^2.12.0 => 2.15.0
gatsby-transformer-sharp: ^2.6.0 => 2.11.0
Does anyone have similar problem, or know how to solve it?
It's not a matter of dependencies or configuration, you have a typo in your project. It seems that somewhere in your JavaScript files (maybe in the templates folder) you have a . (dot) that is breaking your code.
To enable optional chaining in any JavaScript project, since it's not a standard feature, you need to:
Install the dependency (#babel/plugin-proposal-optional-chaining):
npm install --save-dev #babel/plugin-proposal-optional-chaining
Or:
yarn add #babel/plugin-proposal-optional-chaining --dev
Enable it in your Babel configuration. In Gatsby, you can create a babel.config.js (or .babelrc) in the root of your project to customize Babel's configuration:
{
"plugins": [
["#babel/plugin-proposal-optional-chaining"]
],
"presets": [
[
"babel-preset-gatsby",
{
"targets": {
"browsers": [">0.25%", "not dead"]
}
}
]
]
}
Fixed by:
problem was my package-lock.json. After we fixed it, everything works
properly :) nevermind

Cannot run e2e tests with protractor: cannot resolve path?

I can’t seem to run my e2e tests with protractor. Before I begin here is some background info:
Node: 7.7.4
NPM: 4.1.2.
Angular: 4.1.0
Protractor: 5.1.2
After I ran npm install protractor, I installed and updated web driver and got an update for IE. After I wrote my first test—a simple test to grab the text of the h1 tag on my login page—I attempted to run protractor and got an error: Error: Cannot find module ‘ts-node’ so I went and installed that. Now when I rerun protractor I get a mysterious error I cannot resolve: the specified path does not exist: e2e/tsconfig.e2e.json. What does this mean? My protractor conf.js file looks like this:
// Protractor configuration file, see link for more information
// https://github.com/angular/protractor/blob/master/lib/config.ts
const { SpecReporter } = require('jasmine-spec-reporter');
exports.config = {
allScriptsTimeout: 11000,
specs: [ //path of specs is relative to location of protractor.conf.js file.
'./e2e/**/*.e2e-spec.ts'
],
capabilities: {
//'browserName': 'chrome' ---default
'browserName': 'internet explorer',
'platform': 'ANY',
'version': '11'
},
directConnect: true,
baseUrl: 'http://localhost:4200/',
framework: 'jasmine',
// Options to be passed to Jasmine-node.
jasmineNodeOpts: {
showColors: true,
defaultTimeoutInterval: 30000,
print: function() {}
},
beforeLaunch: function() {
require('ts-node').register({
project: 'e2e/tsconfig.e2e.json'
});
},
onPrepare() {
jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } }));
}
};
I tried fooling around with the path under the project parameter, but no luck with that resolving the issue. And my project structure is set up likes this:
Any suggestions? Should I post this as an issue on github? To ts-node? Or protractor? Any suggestions would be appreciated. Please let me know if you need additional context too.
It means it's trying to find tsconfig.e2e.json (the typescript config file for your 'e2e' project) and can't. This part of the config shows the path it's looking for:
beforeLaunch: function() {
require('ts-node').register({
project: 'e2e/tsconfig.e2e.json'
});
},
But it's clear from your directory structure that it isn't there. Given the path to your spec files, I would imagine the line should read:
project: './e2e/tsconfig.e2e.json'
Looking at your project structure though, it could well be:
project: './app/e2e/tsconfig.e2e.json'
In which case, the path to your spec files will probably need changing to match.