<app-layout> doesn't load (is empty) on ng serve --env=dev --aot but works with just ng serve (local) - angular5

This is a quick question:
I'm performing an ng serve
--env=dev100 --aot (the dev100 is our remote server)
The element:
<app-layout></app-layout> **<--- LOOKS LIKE THIS upon completion. EMPTY!**
But, I don't get this issue with I simply do ng serve on my local box.
I've never seen this happen and there are no errors.
Thoughts?

Due to the wonkiness of angular 5's compiler, I had a dead component (something I wasn't using) and had the same signature, per se, as the one that was not being loaded.
EX:
<app-layout></app-layout> <-- NOT BEING LOADED
<app-layout-popover></app-layout-popover> <-- NOT BEING USED
My thought is that the compiler saw only the first part
After I removed the dead component, it compiled and everything's working.

Related

Expo application doesn't get changes in .env file

I have an Expo managed react native application. I created my .env file in the root of my project, installed react-native-dotenv and set up babel to use it. After a while I managed to get it to work.
I have my environment variable
ENDPOINT=http://127.0.0.1:8000/api
and i use it with
process.env.ENDPOINT
After a while I decided to test the android version of the app, so i changed the endpoint url to my LAN ip and restarted the server. The problem is that even after restarting the server, the cache and the computer, when I call process.env.ENDPOINT it keeps the first url I set.
Here's a list of the things i tried:
restarting the server
restarting the server and the cache
restarting the whole computer
change the variable name to REACT_APP_ENDPOINT as many suggested (I get undefined, it's still stuck to ENDPOINT)
empty expo cache
The strange thing is that I already changed that same variable twice (from 127.0.0.1:8000 to 127.0.0.1:8080 and back for a problem with backend) and had the same problem, but it went away by itself after a couple of minutes (and server restarts).
This time I've been trying to get it to work for 7 hours and nothing has changed.
Any idea?
I had the same issue and managed to run the app with .env changes after using the following command.
expo r -c
reference: https://github.com/goatandsheep/react-native-dotenv/issues/75#issuecomment-728055969
After a couple hundred more tests I gave up and implemented a "custom" solution, without any external library:
Switched .env files to TypeScript files (E.g. .env.development -> env.development.ts)
Set up an object named env that has all environmental variables as properties
export const env = {
VAR1: 'foo',
...
}
Imported this constant inside the application entry point (in my case App.tsx)
Inside the main constructor assign env to global.env
Use global.env instead of process.env
Not sure if this is the best practice, but solved my problem for now, works like a charm and doesn't require me to reload my application at every change. I'm a bit concerned by the security aspect of having the environment in a global variable inside a js project, so any suggestion is still welcome

How to debug neovim lsp custom command

I am attempting to get the volar vue language server to work in place of vetur for neovim's native lsp.
Using both lspconfig and lspinstall I was able to create a working custom install for sumneko_lua (unrelated but had to manually build due to some issues with the built-in :LspInstall lua). Below is that code duplicated and modified for an attempt at using this new vue server:
local vue_config = require'lspinstall/util'.extract_config('vuels')
vue_config.default_config.cmd = {'node', './node_modules/vscode-vue-languageservice/out/index.js', '--stdio'}
require'lspinstall/servers'.newvue = vim.tbl_extend('error', vue_config, {
install_script = [[
! test -f package.json && npm init -y --scope=lspinstall || true
npm install vscode-vue-languageservice#latest
]],
uninstall_script = nil
})
Running :LspInstall newvue installs properly, however :LspInfo shows this language server is attached to the buffer (of a .vue file) but not active. I believe the issue is with this path: ./node_modules/vscode-vue-languageservice/out/index.js. It exists, but may not be the correct entry point? The default vue ls simply has vls as the command because it provides a binary. Am I missing something in this package? I have yet to come across another language server without a single binary to pick out.
Thanks!
Can you try an absolute path to the out.js file? In my pretty elaborate config for a custom Volar install I'm using something just /home/myuser/dev/volar/packages/server/out/index.js (where the volar folder is just the whole volar cloned github repo). My full config is here
I don't think you can use relative paths like you did. I know you're assuming that the "./node_modules" means "workspace directory" but it's hard to tell in which directory nvim-lspconfig opens up those executables.
I have yet to come across another language server without a single binary to pick out.
Volar also provides a binary, it's volar-server (after running npm i -g #volar/server), it's just with a custom install (ie. alongside the real volar) you can't use it, because I assume you want to use your local install with custom code.
As for more indepth debugging/logging, you can check ~/.cache/nvim/lsp.log to see why the language server dies in detail.

Translation keys not present in SSR without language fallback

When I disable translation language fallback, then key translations are displayed instead of a particular translation.
However, when running with SSR mode, translation keys are not displayed at all.
I am using the latest version of Spartacus and running server by npm run build:ssr && npm run serve:ssr.
Is there any way to have missing translations displayed in prod mode with enabled SSR?
TLDR;
It's a correct behavior. If you need a custom fallback behavior, please overwrite this method:
https://github.com/SAP/spartacus/blob/4432a2bed0c6cf04aa2ff412792f0e8cb24686a3/projects/core/src/i18n/i18next/i18next-translation.service.ts#L70
Explanation:
SSR runs the production version of the application.
In development mode missing keys are rendered in the HTML (and a warning appears in the console). But in production mode missing keys are rendered in the HTML as a non-breaking space is displayed.
See https://sap.github.io/spartacus-docs/i18n/#fallback-language

Error on running react-native run-android: "Unable to load script"

I did a first project on react-native, that still works when I want to emulate it on my AVD.
I started a react-native init new project that installed correctly but impossible to run it the first time, Node JS command open and shut down in a seconde. And, come to this point :
"Starting: Intent { cmp=com.ms/.MainActivity }"
Nothing happens : the following line is this one : PS C:\Users\arthu\MS>
And I get the error message : "Unable to load script. Make sure you either running a metro server (run react-native' start) or that your bundle 'index.android.bundle' is packaged correctly for release.
Thought it was due to the Node JS console, which was opening a few second, so I emptied its cache, didn't change anything, Re-installing Node JS, re-tried with my ancient project (which works), change port from where I run the project, nothing changed.
I guess it is not linked with Node JS, neither my code (because I didn't even start), but I am a bit confused about that, and didn't find a similar post ! Thank you for your answers ;)

Yii CAssetManager.basePath is invalid on PHPUnit test

i have a problem to run test. My model use extension Yii mail and then i run test its fail with wrong assert path. Another test runs finaly (model dont use any extensions). Preloading is only log.
I had a similar error and I explicitly set the basePath in config/test.php.
'components'=>array(
...
'assetManager'=>array(
'basePath'=>dirname(__FILE__).'/../../assets',
)
)
Im solved problem
public function setUp(){
Yii::app()->assetManager->basePath = '../../asserts';
}
Im dont know why this error throw only in one model...
PhpUnit runs primary in CLI mode and therefore some of environmental variables are missing. Yii's AssetManager uses one of such variable to determine webroot and since the variable does not exist, it will either throw error or set up invalid assets path on first attempt.
In my opinion, this issue is (indirectly) caused by PHPUnit because it only supports CLI testing mode, which makes some things really more difficult to test than it would be in HTTP request mode. Some guys therefore wrote tools to run unit tests via standard web GUI with whole native HTTP environment (e.g. https://github.com/NSinopoli/VisualPHPUnit). Eventually, you may use HTTP clients like Selenium to run your tests as if clicking over the page (see http://phpunit.de/manual/3.7/en/selenium.html).
Nevertheless, it's a matter of subjective opinion - somebody may argue, that testing in CLI mode has advantages, some guys will hate it. But the fact is, that one has to bear in mind differences between HTTP and CLI mode.