-
Notifications
You must be signed in to change notification settings - Fork 142
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
vite find assets & build copy assets #1736
Conversation
patricklx
commented
Dec 19, 2023
•
edited
Loading
edited
- resolves addon & app assets from their origin (not rewritten-app)
- copies addons & apps public assets from origin (not rewritten-app)
471f4a9
to
f67133b
Compare
packages/vite/src/assets.ts
Outdated
const publicAppFiles = glob.sync('**/*', { | ||
cwd: pubDir, | ||
}); | ||
for (const publicAppFile of publicAppFiles) { |
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.
we do not copy the app assets that are available in app pkg meta.assets, because vite does bundle its own asset files. We only need the app public files
03e3f3e
to
9692e8f
Compare
3b57f2a
to
cf1e41f
Compare
e2038c9
to
e7b6465
Compare
Discussion notes from office hours:
|
e799ad3
to
bb40dad
Compare
2192ea9
to
c335877
Compare
5fc919f
to
87ddbc9
Compare
@patricklx what methodology did you use to test the PR? I noticed that it doesn't include the removal of the piece of code that writes the assets in the rewritten app. |
this is what i did
|
Maybe the code you changed also affects some package metadata? expecially |
39a12cf
to
a865db9
Compare
packages/vite/src/assets.ts
Outdated
@@ -66,7 +68,7 @@ export function assets(): Plugin { | |||
this.emitFile({ | |||
type: 'asset', | |||
source: readFileSync(join(pkg.root, path)), | |||
fileName: dest.slice(1), | |||
fileName: join('.', dest), |
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.
interesting, the result for join('.', './a-file')
or join('.', '/a-file')
is always 'a-file'
, nice
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 changed the code to posix.resolve(‘/’, dest).slice(1)
as suggested by Ed, it works as expected with my test setup (no problem in the middleware either) 👍
…he dest path of the emitted file
a865db9
to
45e96e5
Compare
@patricklx for info tomorrow I'll work on the PR to clean-up the compat-app-builder :) |