Building Angular 5 project with CLI using ng build --prod - angular5

When I building my angular 5 project using
ng build --prod
It gives long error as below. It shows part of error.
error TS5055: Cannot write file 'E:/Files/dash-
functional/node_modules/zone.js/dist/long-stack-trace-zone.js' because it
would overwrite in
put file.
Adding a tsconfig.json file will help organize projects that contain both
TypeScript and JavaScript files. Learn more at https://aka.ms/t
sconfig.
error TS5055: Cannot write file 'E:/Files/dash-
functional/node_modules/zone.js/dist/proxy.js' because it would overwrite
input file.
Adding a tsconfig.json file will help organize projects that contain both
TypeScript and JavaScript files. Learn more at https://aka.ms/t
sconfig.
error TS5055: Cannot write file 'E:/Files/dash-
functional/node_modules/zone.js/dist/sync-test.js' because it would
overwrite input file.
Adding a tsconfig.json file will help organize projects that contain both
TypeScript and JavaScript files. Learn more at https://aka.ms/t
sconfig.
error TS5055: Cannot write file 'E:/Files/dash-
functional/node_modules/zone.js/dist/zone.js' because it would overwrite
input file.
Adding a tsconfig.json file will help organize projects that contain both
TypeScript and JavaScript files. Learn more at https://aka.ms/t
sconfig.
After I added tsconfig.json as below also gives error again.
{
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"moduleResolution": "node",
"sourceMap": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"lib": [ "es2015", "dom" ],
"noImplicitAny": true,
"suppressImplicitAnyIndexErrors": true
}
}
How can I solve this. That error is not showing when compiling (ng serve) and build without prod mode.(ng build)

The problem is that the TypeScript compiler is processing the .ts files in your node_modules folder. You'll need to add an exclude array in your .tsconfig file. You can learn more about the .tsconfig file in the TypeScript docs.
{
"compilerOptions": {...},
"exclude": [
"node_modules"
]
}
How did you create your Angular project? If you use the Angular CLI, it will create this file for you already. You may want to generate an example project using the Angular CLI and copy/paste the .tsconfig file it generates (maybe even use that as a starting point for your project).

Related

How to write aws-sdk-cpp[s3] in manifest .vcpkg dependency file for cmake?

I am getting a strange error in in my cmake project in which the dependency I am trying to require does not work. In my vcpkg.json file, I have the following:
{
"name": "glmcmake",
"version-string": "1.0.0",
"dependencies": [
"aws-sdk-cpp[s3]"
]
}
However, when I run cmake I get the following error in the vcpkg-manifests-install.txt file:
$.dependencies[0] (a dependency): must be lowercase alphanumeric+hyphens, split with periods, and not reservedExtended documentation available at 'https://github.com/Microsoft/vcpkg/tree/master/docs/users/manifests.md'.
How do I write the aws-sdk-cpp[s3] dependency in the vcpkg.json file correctly so that it can download the right one? I do not need the entire aws-sdk-cpp library. I only need the s3 subfolder, basically.
When I search for aws-sdk-cpp on vcpkg, I can see the [s3] subfolder in particular, but I cannot get my cmake to agree with the way it is written on vcpkg search.
Any thoughts?
Thanks

Aurelia CLI adding script reference to node_modules folder

I am attempting to add the aurelia-validation plugin to my app. In my aurelia.json file, I have added the module to the dependencies node.
"prepend": [
"node_modules/bluebird/js/browser/bluebird.core.js",
"node_modules/aurelia-cli/lib/resources/scripts/configure-bluebird.js",
"node_modules/requirejs/require.js"
],
"dependencies": [
... Trimmed other packages...
{
"name": "aurelia-validation",
"main": "aurelia-validation",
"path": "../node_modules/aurelia-validation/dist/amd",
"resources": []
}
]
When I look at the index.html file in the browser, I see a script tag in the <head> pointing to aurelia-validation in the node_modules folder.
Which is causing a run time error because that path does not exist in my web root.
Why is the CLI referencing this module like this? Why would it not bundle it like the rest of my files?
Most of the time you can achieve installing/adding reference in aurelia.json using au import/install. See it here.

How to deliver an aurelia library for consumption by aurelia CLI based app

I'm building a library of aurelia custom elements for use by several different aurelia apps and am running into trouble getting the custom element html hooked into the app bundle properly with the CLI process.
I'm currently thinking that the library will be part of package.json and thus listed under node_modules/my-lib. What should the delivered .html format be
<template>...</template>
or should it be delivered in required format
define('text!my-lib/component1.html', ['module'], function(module) { module.exports = "<template>\r\n ...
If the former - what do I put in aurelia.json to get it to be included correctly in the vendor-bundle?
If I do resouces['../node_modules/my-lib/**/*.html'] in my-lib dependency section - it gets included as html in a js file which throws an error.
If I add as source to the vendor-bundle or using my own bundle my-lib-bundle.js
"source": [
"[../node_modules/my-lib/**/*.js]",
"../node_modules/my-lib/**/*.{css,html}"
],
Nothing gets included then except the 'main' listed in the one dependency.
If I add to the markupProcess (which seems more linked to the app and not a library)
"markupProcessor": {
"id": "none",
"displayName": "None",
"fileExtension": ".html",
"source": [
"src\\**\\*.html",
"..\\node_modules\\my-lib\\**\\*.html"
]
},
I get the html correctly added to app-bundle but has the wrong path because it includes the '../node_modules' in the define so it's not found when the app attempt to use it.
I'm not using the CLI to build my lib as I want the app to only include pieces it uses. So the JS is built and delivered in AMD format, but I wasn't sure the process to go through with HTML?
Suggestions?
There is a skeleton plugin repo # github
https://github.com/aurelia/skeleton-plugin
With build scripts and all

How can I pass variable data to package.json file scripts as parameters?

We rename our assets directory on every single git push to handle browser caching issues. This mean that we store a random variable in a config.json file in our project.
I'm trying to move from gulp to npm as a build process, and therefore need to access this stored variable somehow from within the package.json file.
How would I go about such a task, and is it even possible?
"scripts": {
"build-offers": "uglifyjs src/pages/offers/*.js -mc > [HERE I NEED TO PREFIX THE OUTPUT FOLDER USING THE config.json FILE CONTENT] assets/offers.js",
"offers": "npm run build-offers"
},
You can acces environment variables in your scripts, but i think, that it isn't possible to read such variables from an other file with pure package scripts. Here is a way, you could do it within your package.json.
"config": {
"prefix": "prefix"
},
"scripts": {
"build-offers": "uglifyjs src/pages/offers/*.js -mc > %npm_package_config_prefix% assets/offers.js",
...
}
NOTE: The above version only works under windows.

generator-kraken static module out of date?

Just getting started with KrakenJS. After running the generator and looking at the config.json I notice it has the "static" middleware defined as:
"static": {
"module": {
"arguments": [ "path:./.build" ]
}
}
I have two issues/questions:
After running grunt build I see the browserify output in the /.build folder, but when I navigate to /js/app.js it appears to load the file from the /public folder. Shouldn't it be from the /.build folder?
With Express 4+ shouldn't this actually be serve-static?
I can't help but think I'm missing something.
Thanks!
As I guessed, I was missing something.
I dug into the kraken source a bit more and found that the core config defines the "name" property on static as "serve-static", so it is in fact correct when it merges with the config.json in my app.
The other issue I was having with loading from the incorrect folder was because inside the development.json config file the 'kraken-devtools' middleware is configured with the copier compiler, so when the file is requested at runtime it copies it from the /public folder into the /.build folder, overwriting the output from grunt build.