Typescript
See original GitHub issueProject architecture
src/components/index.ts
:
export * from './button';
export * from './input';
src/components/button/index.ts
:
export {Button, IProps as IButtonProps} from './Button.tsx';
and the Button is a mere React component.
Playroom
playroom.config.js
module.exports = {
components: './src/components',
outputPath: './dist/playroom',
webpackConfig: () => ({
module: {
rules: [
{
test: /\.tsx?$/,
use: [{ loader: 'ts-loader' }]
}
]
}
})
};
Error
When running playroom start
, it produces this error:
$ lerna run --parallel start --scope @myProject/myPackage
lerna notice cli v3.6.0
lerna info filter [ '@myProject/myPackage' ]
lerna info Executing command in 1 package: "yarn run start"
@myProject/myPackage: $ playroom start
@myProject/myPackage: (node:55112) UnhandledPromiseRejectionWarning: /Users/marais/Sites/myProject/packages/myPackage/src/components/index.ts:1
@myProject/myPackage: (function (exports, require, module, __filename, __dirname) { export * from './button';
@myProject/myPackage: ^^^^^^
@myProject/myPackage: SyntaxError: Unexpected token export
@myProject/myPackage: at new Script (vm.js:83:7)
@myProject/myPackage: at createScript (vm.js:267:10)
@myProject/myPackage: at Object.runInThisContext (vm.js:319:10)
@myProject/myPackage: at Module._compile (internal/modules/cjs/loader.js:685:28)
@myProject/myPackage: at Object.Module._extensions..js (internal/modules/cjs/loader.js:733:10)
@myProject/myPackage: at Module.load (internal/modules/cjs/loader.js:620:32)
@myProject/myPackage: at tryModuleLoad (internal/modules/cjs/loader.js:560:12)
@myProject/myPackage: at Function.Module._load (internal/modules/cjs/loader.js:552:3)
@myProject/myPackage: at Module.require (internal/modules/cjs/loader.js:658:17)
@myProject/myPackage: at require (internal/modules/cjs/helpers.js:22:18)
@myProject/myPackage: (node:55112) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
@myProject/myPackage: (node:55112) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
lerna success run Ran npm script 'start' in 1 package in 1.1s:
lerna success - @myProject/myPackage
✨ Done in 1.63s.
Question
Is there a way to make the this work?
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:6 (2 by maintainers)
Top Results From Across the Web
TypeScript: JavaScript With Syntax For Types.
TypeScript is a strongly typed programming language that builds on JavaScript, giving you better tooling at any scale. Try TypeScript Now. Online or...
Read more >TypeScript - Wikipedia
TypeScript is a free and open source programming language developed and maintained by Microsoft. It is a strict syntactical superset of JavaScript and...
Read more >TypeScript is a superset of JavaScript that compiles ... - GitHub
TypeScript is a language for application-scale JavaScript. TypeScript adds optional types to JavaScript that support tools for large-scale JavaScript ...
Read more >TypeScript Introduction - W3Schools
TypeScript is a syntactic superset of JavaScript which adds static typing. This basically means that TypeScript adds syntax on top of JavaScript, ...
Read more >TypeScript - The Basics - YouTube
TypeScript has forever altered the lives of JavaScript developers. Learn why TS is so awesome and the basic concepts required to be ...
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
This is working for me. I copied it from the internal webpack config and fixed the paths.
After using @DavidHooper & @vensa-albertgao’s config on my CRA with --typescript project I am getting the following issue:
What can it be?