Comments (7)
Thanks, glad to hear! I'll actually reopen to track the task of updating the docs and maybe adding a runtime check.
from sucrase.
@iki Take a look at webpack/webpack#5548 (comment) , that may have some pointers. I think there are unfortunately some node_modules issues where it's possible to be stuck on an old acorn even though webpack 4 should depend on a recent enough version that supports the syntax. The syntax works for me in webpack 4 with a fresh install, so maybe try reinstalling node_modules from scratch or regenerating your lockfile.
from sucrase.
Thanks for reporting. Since you're on webpack 4, I think object rest/spread should actually work without webpack-object-rest-spread-plugin
. I wrote that plugin before webpack 4 came out, and it's still needed on 3 or earlier. Could you try removing that plugin and see if it works and that you can still have object rest/spread in your code?
I'll update the docs to say that webpack-object-rest-spread-plugin
is not needed in webpack 4. It looks like webpack 4 changed enough to break the plugin, so I'll also see if I can make it print a warning and do nothing if it detects that you're on webpack 4.
from sucrase.
Oh yeah, it works without. I just blindly assumed it was necessary.
Thank you, and keep up the nice project :)
from sucrase.
@alangpierce Actually, I get the above error with webpack4, typescript and webpack-object-rest-spread-plugin. However, if I remove the spread plugin, I get error on the first spread operator:
ERROR in ./src/containers/App.tsx
Module build failed: SyntaxError: ./src/containers/App.tsx: Unexpected token (17:37)
> 17 | const SwitchWithProps = ({ children, ...restProps }) => (
from sucrase.
@alangpierce thanks! updating acorn resolved that: webpack/webpack#5548 (comment)
from sucrase.
Cool, glad to hear.
from sucrase.
Related Issues (20)
- Question: strict mode HOT 2
- Add option to disable TS import/export elision
- Allow arbitrary Sucrase configuration in sucrase/register and the CLI HOT 1
- Transpilation bug, changes `;` to `,` HOT 2
- Constructor return type annotations produce invalid JS syntax HOT 1
- (plugin commonjs--resolver) Syntax Error when importing file with json import HOT 1
- TypeScript: `x < y >= z` is incorrectly interpreted as a type argument list HOT 1
- Incorrect elision of `import {}` with TS transform disabled HOT 1
- TypeScript type-only re-exports not always properly elided
- TypeScript automatic named export elision incorrectly happens for re-export
- Incorrect elision of named import if typings of a callback function contains a parameter with the same name HOT 1
- Sucrase SyntaxError - (7:3) HOT 2
- jest.mock hoisting breaks when using @jest/globals
- Option to just compile JSX to object literal HOT 2
- Unexpected output from an exported mergeable enum HOT 2
- glob lib dependency, depends on Inflight lib which is now introducing a security vulnerability HOT 2
- Exporting declaration after function invocation misses semi
- Empty template spans break sourcemaps HOT 1
- Dont remove `export interface` , instead rename it to something else. HOT 4
- support absolute import with baseUrl 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 sucrase.