Replies: 1 comment
-
Update: I came across https://github.com/martpie/next-transpile-modules, which gets me part of the way there. It seems to work well with |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I have some GitHub repos on my local machine which have some shared "utility" code that I would like to iterate on in parallel with my Next.js projects. My Next.js projects are written in TS and so is the utility code.
Let's say I have the following two repos:
package.json["name"] == "app"
, cloned locally toapp-local
and stored on GitHub in theapp-gh
repo.package.json["name"] == "utils"
, cloned locally toutils-local
and stored on GitHub in theutils-gh
repo.I don't want to go with the "monorepo" approach because I don't want to include the utility code in the app's repo.
Ideally I'd have a workflow like this:
I can easily link
utils-local
toapp-local
so that any references likeimport foo from 'utils/...'
will import the current TS sources fromutils-local
, so that I can developutils-local
andapp-local
in parallel.When ready, I can push a new version of
utils-local
toutils-gh
and then pin the current version ofapp-local
to that version.Ideally there's some way to prevent me from forgetting to pin the version before pushing
app-local
toapp-gh
.Does anyone know a good way to do this? Or, are there alternate workflows to achieve the same goals (iterating on separate repos with a fast edit/refresh cycle)?
I've tried using
yarn link
but to no avail, because Webpack refuses to load those files throughts-loader
and I get a compile-time error when runningnext dev
. Even if I add"node_modules/utils/src/**/*.*"
to the"include"
field oftsconfig.json
inapp-local
, it doesn't work. It also doesn't work if I add the resolved symlink location:"../utils/src/**/*.*"
Do I need to tweak Next.js's Webpack config in order to configure
ts-loader
to allow my locally linked sources? If so, how do I go about that?Beta Was this translation helpful? Give feedback.
All reactions