New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compiler not allows to import packages, whose name contains dot (e.g. "angular.com") #20363

Closed
mmlleevvyy opened this Issue Nov 11, 2017 · 5 comments

Comments

Projects
None yet
5 participants
@mmlleevvyy
Contributor

mmlleevvyy commented Nov 11, 2017

I'm submitting a...


[ ] Regression (a behavior that used to work and stopped working in a new release)
[X] Bug report  
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question

Current behavior

In compiler_host.ts, there is a const NODE_MODULES_PACKAGE_NAME which is a regex, that should validate if a package is from node_modules... but this regex is invalid, as it do not match packages, whose name contains dot (".", eg. "angular.com"). Because of that, when one library requires other library (with name containing dot), compiler throws error "Trying to import a source file from a node_modules package".

Link to const:

const NODE_MODULES_PACKAGE_NAME = /node_modules\/((\w|-)+|(@(\w|-)+\/(\w|-)+))/;

Expected behavior

Node package name may contain dots, so it should be allowed to import that kind of packages and angular compiler should not make any problems ;-).

Environment


Angular version: 5.0.1

 
For Tooling issues:
- Node version: 8.1.4 
- Platform: Mac
@mmlleevvyy

This comment has been minimized.

Contributor

mmlleevvyy commented Nov 12, 2017

Proper regex for matching package name:
node_modules\/((\w|-|\.)+|(@(\w|-|\.)+\/(\w|-|\.)+))

@mmlleevvyy

This comment has been minimized.

Contributor

mmlleevvyy commented Nov 20, 2017

@tbosch Can you look at it please?

@choucry13

This comment has been minimized.

choucry13 commented Nov 21, 2017

+1 please :-)

@pjetja

This comment has been minimized.

pjetja commented Feb 9, 2018

Can I kindly ask for timeline for this to be fixed?

@ngbot ngbot bot modified the milestones: Backlog, needsTriage Feb 26, 2018

mhevery added a commit to mmlleevvyy/angular that referenced this issue Jun 13, 2018

mhevery added a commit to mmlleevvyy/angular that referenced this issue Jun 13, 2018

mhevery added a commit to mmlleevvyy/angular that referenced this issue Jun 13, 2018

mhevery added a commit that referenced this issue Jun 14, 2018

@mhevery mhevery closed this in d8f7b29 Jun 14, 2018

@mmlleevvyy

This comment has been minimized.

Contributor

mmlleevvyy commented Jun 14, 2018

Yuppiii!!! Thanks @mhevery !!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment