-
-
Notifications
You must be signed in to change notification settings - Fork 8.7k
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
Support new export * as ns
syntax
#10460
Comments
Does acorn already support it? |
Sounds like it's implemented inside a plugin: acornjs/acorn#742 (comment) |
acorn PR: acornjs/acorn#889 |
I have this issue with typescript/ts-loader, is it a webpack issue or a ts-loader issue? |
@guillaume86 ts-loader |
It's not a ts-loader issue. It happens because webpack 4 haven't used the newest acornjs version. |
@ooyyloo thanks I'll just for a webpack update then |
Is this the same issue as TypeStrong/ts-loader#1121? If you use a module target lower than es2020 then typescript will transpile the new export * syntax down to a version webpack can understand. |
A current workaround is to use Babel and its @babel/plugin-proposal-export-namespace-from plugin. You can set is up like so for bare-minimum babel: For dependencies,
In your ...
{
test: /\.tsx?$/,
use: [{
loader: "babel-loader", // This should be the last loader of course
options: {
plugins: ["@babel/plugin-proposal-export-namespace-from"]
}
}, ...other loaders]
}
... |
as a temporary solution;
{
...
"resolutions": {
"acorn": "npm:acorn-with-stage3"
},
"dependencies": {
|
A lot of packages rely on acorn. This can potentially break them. It is advisable to build on top rather than directly patch. |
Scoping it to Webpack only would help: "resolutions": {
"webpack/acorn": "npm:acorn-with-stage3"
}, |
This only works on yarn. |
|
|
@appzuka I had to also change {
"compilerOptions": {
"target": "es2015",
"module": "es2015"
}
} |
Feature request
There is new export syntax:
export * as ns
(stage 4).https://github.com/tc39/proposal-export-ns-from
Currently this will error:
FWIW, TypeScript recently added support for this: https://devblogs.microsoft.com/typescript/announcing-typescript-3-8/#export-star-as-namespace-syntax
What is the expected behavior?
What is motivation or use case for adding/changing the behavior?
How should this be implemented in your opinion?
Are you willing to work on this yourself?
yes
The text was updated successfully, but these errors were encountered: