-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Make Wasp work with tsconfig path aliases #2457
base: main
Are you sure you want to change the base?
Changes from all commits
382dc59
79924a0
4d3f95d
a4ab2dd
3fd1830
91b6f80
ae5bcaf
cf3cd30
cf1dc52
611e2c0
804852b
302f7cf
fe2c7c3
c1cd0da
74f3567
09731ab
ef1008b
7f9e078
2b66ac8
9cf176e
b51a56f
f36b33a
6cf7730
871ea87
dda6c0a
2d4c5c9
e9ad9c3
f390cd1
e790ebd
e3f89ad
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -45,7 +45,7 @@ | |
{=! expose it here (which leaks it to our users). We could avoid this by =} | ||
{=! using relative imports inside SDK code (instead of library imports), =} | ||
{=! but I didn't have time to implement it. =} | ||
"./ext-src/*": "./dist/ext-src/*.js", | ||
"./src/*": "./dist/src/*.js", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What do you mean by "renaming aliases", does that mean you'd search & replace There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, both there and in tsconfig |
||
{=! Used by our code, uncodumented (but accessible) for users. =} | ||
"./operations/*": "./dist/operations/*", | ||
{=! Used by our code, uncodumented (but accessible) for users. =} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -43,12 +43,11 @@ | |
// While this is great, we still want to dig deeper at some point to understand | ||
// better why Vite HMR misbehaves when the SDK is recompiled: https://github.com/wasp-lang/wasp/issues/1934 | ||
"incremental": true, | ||
// todo(filip): Only works with common js, see https://www.typescriptlang.org/tsconfig#paths and daily-article. | ||
// "paths": { | ||
// "@wasp/*": [ | ||
// "./*.js" | ||
// ] | ||
// } | ||
"paths": { | ||
{=# paths =} | ||
"{= path =}": ["{= lookupLocation =}"], | ||
{=/ paths =} | ||
} | ||
Comment on lines
+47
to
+50
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When the user doesn't define any aliases, this file still has an empty object. I thought that was cleaner than doing the conditional check, but feel free to disagree :) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looking at the compiler source code it doesn't seem like it will cause any issues 👍 |
||
}, | ||
"include": [ | ||
"." | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
{{={= =}=}} | ||
import esbuild from 'rollup-plugin-esbuild' | ||
import alias from '@rollup/plugin-alias'; | ||
import resolve from '@rollup/plugin-node-resolve'; | ||
|
||
export default [ | ||
createBundle('src/server.ts', 'bundle/server.js'), | ||
|
@@ -17,12 +19,20 @@ function createBundle(inputFilePath, outputFilePath) { | |
sourcemap: true, | ||
}, | ||
plugins: [ | ||
resolve(), | ||
alias({ | ||
entries: [ | ||
{=# aliases =} | ||
{ find: '{= find =}', replacement: '{= replacement =}' }, | ||
{=/ aliases =} | ||
] | ||
Comment on lines
+24
to
+28
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. NOTE: Just like |
||
}), | ||
esbuild({ | ||
target: 'esnext', | ||
}), | ||
], | ||
// We don't want to bundle any of the node_module deps | ||
// as we want to keep them as external dependencies | ||
external: (id) => !/^[./]/.test(id), | ||
external: /node_modules/, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Todo: leave a note about resolution, wasp, and bundling dependencies. Todo: leave a note about why we're using @infomiho I plan to explain this in detail. It's all in my notes. |
||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
This file was deleted.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll either solve this for the next RC or create an issue.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since it's old code, I think it's okay if we just create an issue for this.