yarn workspace example does not with typescript and next 9.0
with-yarn-workspaces
from the next/examples folder - https://github.com/zeit/next.js/tree/canary/examples/with-yarn-workspaces , if i make the shared code as typescript files , i get the error module not found! I was able to fix it by adding next-typescript in next.config.js ,then the code works, but I start getting this warning -"@zeit/next-typescript is no longer needed since Next.js has built-in support for TypeScript now. Please remove it from your next.config.js and your .babelrc. " .so what is the correct way to add support to typescript in local shared code? I tried adding .babelrc with "presets": ["next/babel"] also.
here is the repo with all the above changes- https://github.com/msreekm/next-yarn-workspaces
use typescript shared code without typescript warnings.
Did you follow this guide to get Typescript setup?
I followed these steps with success...
yarn create next-app --example with-yarn-workspaces with-yarn-workspaces-appcd with-yarn-workspaces-app/packages/web-apptouch tsconfig.jsonyarn add --dev typescript @types/react @types/nodeyarn devClosing as it should be working when following new instructions as mentioned above 鈽濓笍
@jamesmosier
It should be noted that there is some problem with watcher: https://github.com/martpie/next-transpile-modules/issues/9
So I had to do these steps:
yarn create next-app --example with-yarn-workspaces <project-folder-name>cd <project-folder-name>/packages/web-apptsconfig.jsonyarn add --dev typescript @types/react @types/nodenext.config.js: (new)const withTM = require('next-transpile-modules');
// Tell webpack to compile the "bar" package
// https://www.npmjs.com/package/next-transpile-modules
module.exports = withTM({
transpileModules: ['bar'],
webpack(config) {
config.resolve.symlinks = true; // source: https://github.com/martpie/next-transpile-modules/issues/9#issuecomment-498766367
return config;
}
});
yarn devThis fixes the watcher problem for me, but files in the top level of the package being imported are not included in hot reloads.
Most helpful comment
This fixes the watcher problem for me, but files in the top level of the package being imported are not included in hot reloads.