Angular 8 --base-href not working since upgrade - javascript

I've been running this code with Angular 4 no problem:
yarn sh-e2e --base-href='https://my-app.com'
sh-e2e is just configuring my settings for protractor testings. However, since I upgraded to Angular 8, I now keep seeing this error: Unknown option: '--base-href'
Most solutions I am seeing, are asking users to set the configurations in their Angular.json file, but I need to be able to set mine dynamically through the CLI. I am basically changing the --base-href based on which environment I am currently deploying in, and another variable.
I've been searching but can't seem to find how to reference the --base-href dynamically, without just setting something in the configuration file (which doesn't fix my problem). I need a command to allow me to set the testing url dynamically. Any help would be appreciated!

yarn sh-e2e --base-url='https://my-app.com'
Referencing it with --base-url instead of --base-href works with Angular 8!

Related

How to Build Production Next.js with Custom Server (Nest.js)

I need help on how should I do compile/build my project using Next.js when I use a custom server.
I actually use Nest.js (TypeScript Node.js Framework) as my Backend and wrap my Next.js inside it (since Nest.js is node based so I think this should work) and it actually working.
This is one of the tutorial that I followed: https://javascript.plainenglish.io/render-next-js-with-nestjs-did-i-just-made-next-js-better-aa294d8d2c67.
And when I tried to build production, Next.js give me error like this
So basically, when I use nest build command, it successfully compiled but only the backend part (which is Nest.js).
Whenever I tried to run into localhost, it would error and said the same thing above.
And the same as the second command (which is I tried to add next build command), it would show the same error.
I know where is the problem is (they basically need the compiled .next/ folder) but kinda confused how to solve this.
Do you have any idea on how I should tell the compiler that the pages/ folder has been moved into src/client/pages?
[EDIT]
Just for your information, this is my folder architecture.
Any kind of ideas would be a really help. Thanks guys!
I just fixed my own issue right after several minutes I post this even I've struggle for like hours!
So, just want to let you guys know if anyone ever comes with the same issue. Somehow, my solution is comes because this Next.js CLI docs, so thanks to that.
What I did is just simply change the directory first into the right Next.js folder's code and start compile it. I did it from package.json build scripts.
"scripts": {
"build": "NODE_ENV=production nest build && NODE_ENV=production cd src/client && next build"
...
}

When I modify a node module in my vue.js project, do I have to recompile something to get it to work? The change is not reflected

I'm working on a Vue.js project and I run into something the Bootstrap-vue module does that I'd like to get rid of. I located the place in the module that causes the behavior and commented it out. However, this is not reflected on the project. Did I miss a step here?
Firstly, never a good idea to alter your node_modules packages directly,
if you want to see the changes then run yarn install or npm install depending on what package your project is running on, after that run your local serve and changes should have taken effect
Side note: if you are working within a team or peer programming then I would not advise the altering of your node_modules, as the package.json would just overwrite the the changes on their side if using a Git environment to share code

How to add current datetime as version number in angular build hash file on index.html

I am facing caching issue with my Angular app. I have used several approach but issue is still there.
For creating the build, I am using following command.
ng build --prod --output-hashing=all --aot
Can we add version number after hash file name like as below.
<script src='runtime.834594739.js?v=12345678'></script>
Please suggest, how to add version number with build file which auto adds in index.html file on runtime.
Thanks
The correct param is --outputHashing, not --output-hashing.
Just focus on -- (double hyphen)
Documentation.
Angular manages that on its own, just use it correctly.

How to get angular2 to work in eclipse with typescript

So I was starting researching about angular2 and since I saw so many references to typescript being prefered I am trying to switch to it from javascript. Problem is, I saw a nice little guide I could follow to install it all in eclipse (angular, javascript, everything needed to launch the 5 minute guide code on the main page of angular), so I did it and managed to get it to work.
Now I would like to do the same with typescript, but I find myself lost since it doesn't seem to be working, I can't launch code, it's like node.js isn't working anymore, but since I do not know what the expected result is, I am not sure what is missing.
For example, I re did the 5 minute guide and notice as a difference that I do not have the installation of the modules, nor any run-as configuration ready, in fact, I can't manage to run as any typescript code I try to do.
What I did was:
1- Install Eclipse Mars, other guys uses older versions
2- Install Node.js
3- Install WildFly Server
4- Install TypeScript plugin https://marketplace.eclipse.org/content/typescript
5- Import my project in eclipse, you may have to create a new static web project and add your files in there. The 5 minute quick start is not an eclipse web project so you may not be able to import this. Do not forget to copy and past the same structure with the node modules that you have
6- Right click on the project > Configure > Enable Typescript Builder
7- Right Click the project > Properties > TypeScript > Compiler and configure as follows:
I hope this will do it for you.
Remember, this plugin does not respect json configuration file, so you have to do this manually as in the screenshot. Also, if you are going to provide arguments to your component constructor, You will have errors. Let me know if you got those. Another thing to mention is that using some annotations like #Input will not work, you will have to use inputs:[] inside your #Component annotation.
You can try to add those plugins on top of Mars:
https://github.com/angelozerr/angular2-eclipse
https://github.com/angelozerr/typescript.java
Those 2 are incubating but already provide good features. There is another one, that I didn't try but which has some popularity:
https://github.com/palantir/eclipse-typescript
Eclipse >= Neon
sudo npm install -g angular-cli (ng help must work)
See: https://github.com/angelozerr/angular2-eclipse
Install it and restart Eclipse
Open a .ts file
Eclipse Oxygen
Default javascript installation, then added the default free plugin for angular 2 / typescript from here:
angular2.ide - http://oss.opensagres.fr/angular2-eclipse/1.3.0/
After installing I opened an existing Angular 4 / TS project, worked fine. I then installed support for .scss from http://www.liclipse.com/text/updates. All setup and configured with Typescript 2.4.1 / nodejs v6.9.4.
But within days it now fails to open .ts files at all. Re-installation of the ng plugin did not fix it, I uninstalled liclipse plugin and no change either. It basically leaves eclipse unusable for ng4 projects as is.
The logs show the following errors.
org.eclipse.core.runtime.CoreException: Plug-in "ts.eclipse.ide.jsdt.ui" was unable to instantiate class "ts.eclipse.ide.jsdt.internal.ui.editor.TypeScriptEditor".
at org.eclipse.core.internal.registry.osgi.RegistryStrategyOSGI.throwException(RegistryStrategyOSGI.java:194)
at org.eclipse.core.internal.registry.osgi.RegistryStrategyOSGI.createExecutableExtension(RegistryStrategyOSGI.java:188)
at org.eclipse.core.internal.registry.ExtensionRegistry.createExecutableExtension(ExtensionRegistry.java:905)
...
Caused by: java.lang.NoClassDefFoundError: org/eclipse/wst/jsdt/ui/text/JavaScriptSourceViewerConfiguration
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Unknown Source)
...
Caused by: java.lang.ClassNotFoundException: An error occurred while automatically activating bundle org.eclipse.wst.jsdt.ui (441).
at org.eclipse.osgi.internal.hooks.EclipseLazyStarter.postFindLocalClass(EclipseLazyStarter.java:112)
at org.eclipse.osgi.internal.loader.classpath.ClasspathManager.findLocalClass(ClasspathManager.java:529)
...
Caused by: java.lang.ClassFormatError: Name index 1 in LocalVariableTable has bad constant type in class file org/eclipse/wst/jsdt/internal/core/JavaModelManager
I found
TypeEcs plugin for Typescript
it provide below.
•Syntax highlighting
•Code Completion
•Code Outline
•Find References
•Rename / Refactor
•Open Type
•Code Compilation
•Format Code
•Comment Code
•Open Declaration
•Mark Occurences
•Type Script Debug

Adding cordova to existing angular-lungo template

I am trying to figure out how I would go about adding cordova to my project which has angular.js and lungo.js included in it. Here's the error I get :
Error: Current working directory is not a Cordova-based project.
How would I make it a Cordova project?
I also tried the other way around. That was : By creating a cordova project first, then adding angular.js and lungo.js in it. I'm using grunt to init the scaffold template.
Here's the error:
Philippes-MacBook-Pro:hello Phil$ grunt-init lungo-angular-bridge
Running "init:lungo-angular-bridge" (init) task
This task will create one or more files in the current directory, based on the
environment and the answers to a few questions. Note that answering "?" to any
question will show question-specific help and answering "none" to most questions
will leave its value blank.
Warning: Existing files may be overwritten! Use --force to continue.
Aborted due to warnings.
Now, I'm not sure how I could make cordova, angular.js, lungo.js all be included correctly.
Any help would be appreciated.
Thank you,
Phil.
First thing I would check is if the .cordova file is being created.
If not, try running this command from the repository: cordova create

Categories