require not working
See original GitHub issueBug Report or Feature Request (mark with an x
)
- bug report -> please search issues before submitting
- feature request
Versions.
@angular/cli: 1.0.0 node: 6.9.4 os: win32 x64
Repro steps.
run ng new angular-cli-require-test
add const requireTest = require('@angular/common');
in AppModule
run ng build
The log given by the failure.
ERROR in C:/Sandboxes/Research/angular-cli-require-test/src/app/app.module.ts (8,19): Cannot find name ‘require’.
Desired functionality.
I would like to see require work in an angular-cli project.
Mention any other details that might be useful.
I need require to set up highcharts per documentation
Issue Analytics
- State:
- Created 6 years ago
- Reactions:1
- Comments:8 (3 by maintainers)
Top Results From Across the Web
javascript - require not working as expected - Stack Overflow
It's because you're trying to load a node module that has not been installed. Sometimes too, other dependencies ...
Read more >Javascript - How to fix ReferenceError: require is not defined
Fix require is not defined in a browser. The JavaScript require() function is only available by default in Node.js environment. This means the ......
Read more >Fix "require is not defined" in JavaScript/Node - Stack Abuse
The require method is not available in the browser. To solve this, you have a few options, a few of which we'll briefly...
Read more >Common Errors - RequireJS
Module name ... has not been loaded yet for context: ...§ 4 ; //If this code is not in a define call, //DO...
Read more >How to fix the error `require is not defined` in Node.js
Today I started writing a new project on Node.js and got this error on the very first run: const express = require('express'); ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Until this issue is resolved you can workaround it by declaring it.
declare const require: any;
Overall, whenever you need to do
const lib = require('lib')
you can instead doimport * as lib from 'lib';
.