Giter Site home page Giter Site logo

martpie / monorepo-typescript-next-the-sane-way Goto Github PK

View Code? Open in Web Editor NEW
143.0 5.0 19.0 738 KB

A monorepo example using TypeScript and Next.js

License: MIT License

JavaScript 26.06% TypeScript 73.94%
nextjs typescript monorepo tslint jest javascript next

monorepo-typescript-next-the-sane-way's People

Contributors

martpie avatar stigkj 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  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

monorepo-typescript-next-the-sane-way's Issues

Recompiling after every page request

This one is related to closed #2. In a nutshell, running npm run dev on Windows it keeps recompiling app over and over - without any file modifications. @martpie have you seen this before? Is it expected?

It shows following file is getting changed:

website\.next\react-loadable-manifest.json

npm run dev terminates after a few page view on Windows

  • After running npm i in <root>, <root>/shared and <root>/website folders,
  • after running npm run dev in <root>/website folder,
  • after opening http://localhost:3000 and refreshing page several times,
  • node process crashes with error:
PS C:\art\monorepo-typescript-next-the-sane-way-master\website> npm run dev

> [email protected] dev C:\art\monorepo-typescript-next-the-sane-way-master\website
> ts-node-dev --files --project tsconfig.server.json server/index.ts --ignore-watch "{**/*,!(server)/**/*.ts}"

Using ts-node version 8.0.3, typescript version 3.3.4000
[INFO] No PORT environment variable specified, default to 3000

Compiling ...
[INFO] 12:05:52 Restarting: C:\art\monorepo-typescript-next-the-sane-way-master\website\.next\react-loadable-manifest.json has been modified
Using ts-node version 8.0.3, typescript version 3.3.4000
[INFO] No PORT environment variable specified, default to 3000

Compiling ...
Using ts-node version 8.0.3, typescript version 3.3.4000
[INFO] No PORT environment variable specified, default to 3000

Error: EPERM: operation not permitted, watch
    at FSEvent.FSWatcher._handle.onchange (internal/fs/watchers.js:123:28)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] dev: `ts-node-dev --files --project tsconfig.server.json server/index.ts --ignore-watch "{**/*,!(server)/**/*.ts}"`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] dev script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Alen\AppData\Roaming\npm-cache\_logs\2019-05-08T02_06_06_841Z-debug.log

Need more information on how to use transpile module to include a complete module.

I tried this similar approach used here to integrate module from react JS to next JS. I am successfully able to do so. But i get few build error.

I am actually transpiling the whole package in my next JS. which works fine. But i am getting this error. Can you help me.

This is where i import shopping list from another project using npm link. and use transpile-module to resolve all dependencies.

Screenshot 2021-05-13 at 8 51 01 PM

Error in next JS after the import.

Screenshot 2021-05-13 at 8 49 28 PM

This is package file of shopping-list module.

Screenshot 2021-05-13 at 8 50 03 PM

This is index.js which is imported as shopping-list.

Screenshot 2021-05-13 at 8 50 20 PM

npm start doesn't work on Windows

Taking into account it is sample repo, don't treat this issue very seriously, but it is worth mentioning in readme it was created on Linux (or MacOS?) and may not work in other environments.

Specifically, executing npm start terminates with error:

PS C:\art\monorepo-typescript-next-the-sane-way-master\website> npm start

> [email protected] start C:\art\monorepo-typescript-next-the-sane-way-master\website
> NODE_ENV=production node .next/production-server/server/index.js

'NODE_ENV' is not recognized as an internal or external command,
operable program or batch file.

Error: Cannot find module 'next-transpile-modules.js'

> [email protected] dev
> next

ready - started server on 0.0.0.0:3000, url: http://localhost:3000
error - Failed to load next.config.js, see more info here https://nextjs.org/docs/messages/next-config-error
Error: Cannot find module 'next-transpile-modules.js'
Require stack:
- /home/johnathan/monorepo-typescript-next-the-sane-way/website/next.config.js

I think you need to remove the .js from const withTM = require('next-transpile-modules.js')(['shared']);
https://github.com/martpie/monorepo-typescript-next-the-sane-way/blob/master/website/next.config.js

Worked fine for me after that.

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.