martpie / monorepo-typescript-next-the-sane-way Goto Github PK
View Code? Open in Web Editor NEWA monorepo example using TypeScript and Next.js
License: MIT License
A monorepo example using TypeScript and Next.js
License: MIT License
npm i
in <root>
, <root>/shared
and <root>/website
folders,npm run dev
in <root>/website
folder,http://localhost:3000
and refreshing page several times,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
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.
Error in next JS after the import.
This is package file of shopping-list module.
This is index.js which is imported as shopping-list.
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.
> [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.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.