Currently, I am facing an issue while attempting to create a project in Angular 5 that involves utilizing chartist @types and js files of chartist plugins.
Interestingly, the files compile without any issues in Angular 4, but encounter difficulties when trying to compile or load in Angular 5.
I find myself in a state of confusion regarding the necessary steps to resolve this matter.
Encountering an error during compilation: ERROR in error TS5055: Cannot write file '/chartist/chartist-plugin-tooltip.js' because it would overwrite the input file
In this particular scenario, I directly import files in the components as shown below:
import * as CLegend from "../../../chartist/chartist.legend";
import * as CPoints from "../../../chartist/chartist.pointlabels";
import * as CFDoughnut from '../../../chartist/chartist.fill-donut';
import * as CTooltip from '../../../chartist/chartist-plugin-tooltip';
Interestingly, this method works perfectly fine in Angular 4.
In scenarios where compilation is successful:
I have included the aforementioned files in angular-cli.json
under the scripts
key within an array.
"scripts": [
"../chartist/chartist.legend.js",
"../chartist/chartist.pointlabels.js",
"../chartist/chartist.fill-donut.js",
"../chartist/chartist-plugin-tooltip.js"
]
I have made an attempt following this guide, which enabled a successful compilation. However, I encountered errors in JavaScript stating that Chartist.plugins
is undefined.
Additionally, I have tried adding the following to my typings.d.ts
:
interface Chartist {
plugins? : any
}
as well as:
declare module 'ChartistLegend';
declare module 'ChartistPoints';
declare module 'ChartistFDoughnut';
declare module 'ChartistTooltip';
I have attempted to use both of these methods individually, but not simultaneously.
ng -v
output:
_ _ ____ _ ___
/ \ _ __ __ _ _ _| | __ _ _ __ / ___| | |_ _|
/ △ \ | '_ \ / _` | | | | |/ _` | '__| | | | | | |
/ ___ \| | | | (_| | |_| | | (_| | | | |___| |___ | |
/_/ \_\_| |_|\__, |\__,_|_|\__,_|_| \____|_____|___|
|___/
Angular CLI: 1.6.3
Node: 6.11.0
OS: win32 x64
Angular: 5.1.3
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router
@angular/cdk: 5.0.3
@angular/cli: 1.6.3
@angular/material-moment-adapter: 5.0.3
@angular/material: 5.0.3
@angular-devkit/build-optimizer: 0.0.36
@angular-devkit/core: 0.0.22
@angular-devkit/schematics: 0.0.42
@ngtools/json-schema: 1.1.0
@ngtools/webpack: 1.9.3
@schematics/angular: 0.1.11
@schematics/schematics: 0.0.11
typescript: 2.4.2
webpack: 3.10.0
Sincerely,
PS: Please excuse any errors as my fingers are quite cold.
EDIT 1: Added information about Angular versions