Having trouble compiling this library in a typescript react project targetting es5
See original GitHub issueI’m not completely sure what’s causing this, but I wonder if it’s because this project seems to be targetting esnext? The current project I’m on has es5 as the target. The only thing that seems to fix the compilation error below is to set my target to esnext, but that introduces other errors in other files in my project.
./node_modules/react-diff-viewer/lib/styles.js
Module parse failed: Unexpected token (5:42)
You may need an appropriate loader to handle this file type.
| const emotion_1 = require("emotion");
| exports.default = (styleOverride) => {
| const { variables: overrideVariables, ...styles } = styleOverride;
| const variables = {
| ...{
Issue Analytics
- State:
- Created 4 years ago
- Reactions:2
- Comments:14 (5 by maintainers)
Top Results From Across the Web
How to have Typescript target ES5 with React in Webpack?
The answer is, you can't. Babel can transpile ES7 to ES6. But it can't transpile ES6 to ES5, for that it uses a...
Read more >TSConfig Option: target - TypeScript
The target setting changes which JS features are downleveled and which are left intact. For example, an arrow function () => this will...
Read more >Compiling and bundling TypeScript libraries with Webpack
This way we have all the es6 typings while targeting es5 . "outDir": "lib". The compiled source is going to be saved into...
Read more >Publishing Node modules with TypeScript and ES modules
Its typing system and compiler are able to catch a variety of bugs at compile time before your software has even run, and...
Read more >Content Types - ESBuild
ts files) is not supported. If you are writing a library in TypeScript and you want to publish the compiled JavaScript code as...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@praneshr I think It’s better to indicate this module is targeted to ESNEXT in README file, so that we can add this module to the transpiling target.
same issue here, I am using
react-scripts-ts
so I cannot change the webpack configuration. Any suggestion?