GithubHelp home page GithubHelp logo

deptno / typescript-monorepo-next-example Goto Github PK

View Code? Open in Web Editor NEW
43.0 5.0 10.0 51 KB

TypeScript@3 monorepo example next.js version

JavaScript 44.72% TypeScript 55.28%
typescript monorepo workspace next nextjs typescript-monorepo typescript-monorepo-next typescript-monorepo-nextjs example monorepo-example

typescript-monorepo-next-example's Introduction

typescript-monorepo-next-example

<ComponentA>

๐Ÿ™‰๐Ÿ™‰ TypeScript Monorepo Sample
Required TypeScript@3 above

Create monorepo with next.js

Prerequisition

yarn

Create monorepo

$ mkdir typescript-monorepo && cd $_
$ yarn init -y -p
$ mkdir -p packages/app && cd $_
$ yarn init -y
$ yarn add -D typescript @types/react
$ yarn add next react react-dom @zeit/next-typescript
$ mkdir pages
$ touch pages/index.tsx next.config.js .babelrc.js tsconfig.json
$ cd ../.. # change root directory

Configure typescript monorepo

Create component

$ mkdir -p packages/component-a && cd $_
$ yarn init -y
$ yarn add -D typescript @types/react
$ yarn add react
$ touch index.tsx tsconfig.json
$ cd ../.. # change root directory
$ yarn
$ yarn build:packages # or yarn build:packages:watch
$ yarn start

Related

typescript-monorepo-next-example's People

Contributors

deptno avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

typescript-monorepo-next-example's Issues

[Question] Do not transpile `component-a`

Hey there!

Thank you so much for this example! ๐Ÿ‘ I have a question regarding the compilation of the component-a package. I would like to not commit the compiled JS output into the repo. Is it possible to use the TS files directly?

I updated next to v7 and removed the compiled files (.js, ...), but I get the following error:

../component-a/index.tsx 3:23
Module parse failed: Unexpected token (3:23)
You may need an appropriate loader to handle this file type.
| import * as React from 'react'
| 
> export const ComponentA: React.SFC<{}> = props =>
|   <div>ComponentA</div>
|

Is it possible to configure babel/webpack such that the TS files are compiled on the fly?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.