Comments (7)
Hey @qbx2! We really appreciate you taking the time to report an issue. The collaborators on this project attempt to help as many people as possible, but we're a limited number of volunteers, so it's possible this won't be addressed swiftly.
If you need any help, or just have general Babel or JavaScript questions, we have a vibrant Slack community that typically always has someone willing to help. You can sign-up here for an invite.
from babel.
The two syntaxes are equivalent (like choosing to use single vs double quotes in strings), and module
is deprecated. I think Babel should keep the current behaviour.
from babel.
@nicolo-ribaudo In old TypeScript, you might be right. However in the latest TypeScript, 'module' is not deprecated and different from namespace.
from babel.
From https://www.typescriptlang.org/docs/handbook/namespaces.html ,
A note about terminology: Itās important to note that in TypeScript 1.5, the nomenclature has changed. āInternal modulesā are now ānamespacesā. āExternal modulesā are now simply āmodulesā, as to align with ECMAScript 2015ās terminology, (namely that module X { is equivalent to the now-preferred namespace X {).
This post outlines the various ways to organize your code using namespaces (previously āinternal modulesā) in TypeScript. As we alluded in our note about terminology, āinternal modulesā are now referred to as ānamespacesā. Additionally, anywhere the module keyword was used when declaring an internal module, the namespace keyword can and should be used instead. This avoids confusing new users by overloading them with similarly named terms.
It seems that youāre talking that āinternal moduleā is deprecated but Iām talking that babel rewrites āexternal moduleā to ānamespace (internal module)ā
from babel.
The difference of two is: āmoduleā wonāt be shared across files. Unlike āmoduleā, ānamespaceā can be shared across files if the name is equivalent. Therefore, it can lead to a name conflict to rewrite module to namespace.
from babel.
"external modules" are when you write import
/export
at the top level of the file, not the code you are showing (which is an internal module).
From the docs you quoted: "(namely that module X { is equivalent to the now-preferred namespace X {)."
from babel.
@nicolo-ribaudo Oh, there was my misunderstanding. Thank you for the clarification.
from babel.
Related Issues (20)
- [Bug]: When I pull the Babel source code and execute the make bootstrap command, a syntax error is reported HOT 4
- [Bug]: No strict library versions in package.json HOT 8
- Convert remaning runtime helpers to TypeScript HOT 22
- @babel/plugin-proposal-duplicate-named-capturing-groups-regex: support dynamically created regular expressions HOT 5
- [Bug]: @babel/traverse incorrect constantViolations with destructuring HOT 1
- [Bug]: transitive dependency of @ampproject/remapping flagged as malware HOT 3
- [Bug]: path.scope.getBinding(..) has fake referencePaths after some manipulations HOT 2
- Runner Keeps Running in Background HOT 3
- [Bug]: `@babel/plugin-proposal-json-module` may output some ESM code (or even call `undefined` as if it's a function) to CJS outputs HOT 5
- Error when parsing `eval` in `.d.ts` HOT 1
- [Bug]: 8.0.0-alpha.9 [commander] TypeError: Cannot read properties of undefined (reading 'program') HOT 3
- [Bug]: @babel/preset-env č®¾ē½® useBuiltIns äøŗ usage ę¶ę„äøé¢čæäøŖé HOT 3
- [Bug]: @babel/preset-env č®¾ē½® useBuiltIns äøŗ usage ę¶ę„äøé¢čæäøŖé HOT 1
- [Bug]: Runtime error after upgrade @babel/node to 7.24.6 HOT 3
- [Bug]: error "unknown option" raised when using @babel/node as CLI HOT 1
- [Bug]: Circular dependencies: `@babel/core` and `@babel/helper-module-transforms` HOT 1
- [Bug]: @babel/helper-plugin-utils@npm:7.24.7: No candidates found HOT 4
- [Bug]: No matching version found for @babel/helper-string-parser@^7.24.7 HOT 4
- [Bug]: export import does not export in Babel (works in TypeScript) HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
š Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ššš
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ā¤ļø Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from babel.