-
-
Notifications
You must be signed in to change notification settings - Fork 322
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TS paths
config (imports with "@-paths") does not work for imports in TS workers
#489
Comments
paths
config does not work for imports in TS workerspaths
config (imports with "@-paths") does not work for imports in TS workers
Are you passing the aliases to your next.config webpack config? I have a similar paths setup and I ensure I do that in all next projects:
|
@joelpierre Thanks for the input & sorry for the late response. I didn't find the time to test this earlier... I actually did not adjust the webpack config within my next config. However, I can't get it to run with this neither as I'm always getting the following error which seems like it is still not picking up those additional
I'm importing the following within
Here's my config & folder structure in detail:
I'd really appreciate some help with this as I'm a little stuck on what I might be doing wrong here... Thanks! |
FYI, I bootstrapped my app with create-t3-app which might be interesting to know... |
Summary
I have set up my
tsconfig.json
with the following:This way I can import everything within
src/...
with nice absolute paths likeimport { format } from '@/utils/date.helpers';
.I'm using this pattern throughout my app.
In the custom TS worker example, you're writing "... Yes! you can share codes between web app and the service worker! ...", but this doesn't seem to work with those @-paths.
When importing above mentioned
import { format } from '@/utils/date.helpers';
in the worker I get the following error on compilation:If I change the import within the worker file to use an absolute path (e.g.
./../src/utils/date.helpers
), it still errors as the importeddate.helpers.ts
file itself also uses those @-paths which means I'd probably need to get rid of all those @-paths in all files imported in a worker which I really don't want to...Am I doing something wrong here or can I fix this somehow myself?
Versions
next-pwa
: 5.6.0next
: 13.4.9How To Reproduce
Steps to reproduce the behavior:
paths
intsconfig.json
as shown described aboveExpected Behaviors
Compiles without errors
The text was updated successfully, but these errors were encountered: