Skip to content
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

Reopen / comment on #5043 (Add .json extension is missing from webpack resolve.extensions) #13576

Closed
broofa opened this issue Feb 1, 2019 · 3 comments

Comments

@broofa
Copy link

broofa commented Feb 1, 2019

See #5043

tl;dr Please reopen that issue (and close this one)

Opening a new issue here because

  1. This comment has gone unresponded to for 6 months
  2. Tried reaching out to https://gitter.im/angular/angular-cli with no success
  3. I just pinged @filipesilva on that issue, but I'm a little low on blood sugar (read "impatient") and kind of annoyed that I find myself having to yet again deal with an Angular user who expects me to fix a problem that pretty clearly seems to be an Angular issue.

So... Sorry? I don't want to be an ass by intentionally opening a duplicate issue, but it'd be nice to see some movement on this, or at least an explanation for not moving on it.

@clydin
Copy link
Member

clydin commented Feb 2, 2019

Don't worry about the new issue. It's actually preferred to open a new issue when there is still a concern regarding a long closed issue (in this case almost 2 years).

As to an explanation, this issue is not truly an Angular CLI specific issue. Treating JSON as a JavaScript module is specific to the Node.js platform and is also non-standard from the viewpoint of ES modules existing in ES2015+. If a package is to be considered cross-platform (i.e., supporting Node.js and browsers) then it should ideally not assume specific bundler configurations or bundler capabilities to workaround Node.js specific behavior.

By making a small change to line 50 (and 70-71) of the build script in the package, JSON can be completely eliminated from the situation. This not only avoids the entire file extension concern but also provides a path to eventual ES module compliant code.

  fs.writeFileSync(path, 'module.exports = ' + JSON.stringify(types) + ';');
writeTypesFile(standard, path.join(__dirname, '../types', 'standard.js'));
writeTypesFile(other, path.join(__dirname, '../types', 'other.js'));

@alan-agius4
Copy link
Collaborator

Closing following the suggestions mentioned above.

@angular-automatic-lock-bot
Copy link

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.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 9, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants