import * as not working
See original GitHub issueπ bug report
Affected Package
The issue is caused by package @angular/....Is this a regression?
Yes, the previous version in which this bug was not present was: no ideaDescription
I am using this utils to show configuration and run local test, It is working fine as a standalone (without angular). URL : https://github.com/indraraj26/automate-ng-build-process
import * as chalk from 'chalk';
import * as env from './src/environments/environment';
import * as envStaging from './src/environments/environment.staging';
import * as envProduction from './src/environments/environment.prod';
import * as envDev from './src/environments/environment.dev';
π¬ Minimal Reproduction
https://stackblitz.com/...π₯ Exception or Error
D:\test\latest\ng-test>npm run ts-node automate
> test-@0.1.0 ts-node D:\test\latest\ng-test
> ts-node "automate"
D:\test\latest\ng-test\automate.ts:12
import * as chalk from 'chalk';
^
SyntaxError: Unexpected token *
at Module._compile (internal/modules/cjs/loader.js:721:23)
π Your Environment
Angular Version:
>ng --version
_ _ ____ _ ___
/ \ _ __ __ _ _ _| | __ _ _ __ / ___| | |_ _|
/ β³ \ | '_ \ / _` | | | | |/ _` | '__| | | | | | |
/ ___ \| | | | (_| | |_| | | (_| | | | |___| |___ | |
/_/ \_\_| |_|\__, |\__,_|_|\__,_|_| \____|_____|___|
|___/
Angular CLI: 9.0.3
Node: 10.16.0
OS: win32 x64
Angular: 9.0.2
... animations, common, compiler, compiler-cli, core, forms
... language-service, localize, platform-browser
... platform-browser-dynamic, router
Ivy Workspace: Yes
Package Version
-----------------------------------------------------------
@angular-devkit/architect 0.900.3
@angular-devkit/build-angular 0.900.3
@angular-devkit/build-optimizer 0.900.3
@angular-devkit/build-webpack 0.900.3
@angular-devkit/core 9.0.3
@angular-devkit/schematics 9.0.3
@angular/cdk 8.2.3
@angular/cli 9.0.3
@angular/material 8.2.3
@ngtools/webpack 9.0.3
@schematics/angular 9.0.3
@schematics/update 0.900.3
rxjs 6.5.4
typescript 3.7.5
webpack 4.41.2
Anything else relevant?
Issue Analytics
- State:
- Created 3 years ago
- Comments:13 (6 by maintainers)
Top Results From Across the Web
python - Import not Working - Stack Overflow
In python all modules have their own global namespaces, and A namespace containing all the built-in names is created, and module don't shareΒ ......
Read more >5. The import system β Python 3.11.1 documentation
Python code in one module gains access to the code in another module by the process of importing it. The import statement is...
Read more >Traps for the Unwary in Python's Import System
I'm using a similar layout described here and using explicit relative imports in my tests, however I'm running into numerous problems when I...
Read more >Fix problems importing mail - Gmail Help - Google Support
Quick fixes to try first Β· On your computer, open Gmail. Β· In the top right, click Settings Settings and then See all...
Read more >@import not working | Apple Developer Forums
In general when seing the error "use of '@import' when modules are disabled" it means that at least one of the targets that...
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 FreeTop 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
Top GitHub Comments
@indraraj26 - this is because
ts-node
reads thetsconfig.json
file by default and in that file you will find"module": "esnext"
.So when
ts-node
compiles the TS file the output JS, which node is trying to run, will include theimport
statement. The two solutions are:tsconfig.json
and pass this tots-node
via the-p
flag.Thank you @petebacondarwin . it is resolved with second option now my util will be helpful for me/others in future.