Problem installing an external script and referencing a variable from it globally (MathJax)
See original GitHub issueBug Report or Feature Request (mark with an x
)
- [x] bug report -> please search issues before submitting
- [ ] feature request
Versions.
Output from: ng --version
:
@angular/cli: 1.0.0
node: 7.2.1
os: win32 x64
@angular/common: 4.0.1
@angular/compiler: 4.0.1
@angular/core: 4.0.1
@angular/forms: 4.0.1
@angular/http: 4.0.1
@angular/material: 2.0.0-beta.2
@angular/platform-browser: 4.0.1
@angular/platform-browser-dynamic: 4.0.1
@angular/router: 4.0.1
@angular/cli: 1.0.0
@angular/compiler-cli: 4.0.1
OS: Windows 10.
Repro steps.
I previously set yarn as my default package manager.
I started the project with
ng new math-bug
I installed dependencies
yarn add express body-parser mathjax mongoose
yarn add @types\mathjax --dev
I modified the file .angular-cli.json adding the following to the scripts array (previously empty).
"../node_modules/mathjax/MathJax.js"
I added a component to my project that uses the line: “MathJax.Hub.Queue([ “Typeset”, MathJax.Hub, this.id]);”
The log given by the failure.
When I build my project I get the error: ERROR in C:/Users/Pat/ProgrammingProjects/math-bug/src/app/latex/latex.component.ts (23,9): Cannot find name ‘MathJax’. C:/Users/Pat/ProgrammingProjects/math-bug/src/app/latex/latex.component.ts (23,40): Cannot find name ‘MathJax’.
ERROR in C:/Users/Pat/ProgrammingProjects/math-bug/src/app/latex/latex.component.ts (23,9): Cannot find name ‘MathJax’. C:/Users/Pat/ProgrammingProjects/math-bug/src/app/latex/latex.component.ts (23,40): Cannot find name ‘MathJax’.
Desired functionality.
I would like to be able to use MathJax on my project. I previously had an Angular 2 project that used systemjs where this was not a problem. I believe I followed all the instructions for global library installation as described here, but it’s possible I’m misunderstanding something.
Mention any other details that might be useful.
I built a repo that demonstrated what’s happening. It can be seen here
Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (1 by maintainers)
Try adding
"mathjax"
to thetypes
array insrc/tsconfig.app.json
. I had a similar error and that fixed it for me.This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.