You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I just wanted to raise an issue in case we can improve the code or if someone else faces a similar problem.
I had the issue while using the https://github.com/kucrut/vite-for-wp-example-svelte example, but the issue is related to this repo's code.
So here's the issue I've got :
I have the habit to work in my ~/DEV directory and to symlink relevant folders to the WordPress plugin directory. With npm run dev everything is fine, but with a prod build the URL of the main script is wrongly created.
On this line, since I am working from another directory (ex: /home/USER/DEV/wp-plugin-dev), the $manifest_dir has no overlap with $content_dir so nothing get replaced.
The computed URL looks like this : https://wp.dev.local/wp-content/home/USER/DEV/wp-plugin-dev/app/dist but should instead look like this : https://wp.dev.local/wp-content/wp-plugin-dev/app/dist.
Just to be clear, putting the actual root of the project in the WordPress plugins directory, so this issue should not really happen in real productions environments.
How to reproduce
Clone and link the repo
cd~/DEV # or any folder you want
git clone https://github.com/kucrut/vite-for-wp-example-svelte
ln -s .~/DEV/dev_wordpress
composer install && npm install && npm run build
Activate the plugin in WordPress
Look into the Network tab into the inspector => the request for main-XXXXX.js is 404
Hope it's clear enough!
The text was updated successfully, but these errors were encountered:
Hey! Awesome work here.
I just wanted to raise an issue in case we can improve the code or if someone else faces a similar problem.
I had the issue while using the
https://github.com/kucrut/vite-for-wp-example-svelte
example, but the issue is related to this repo's code.So here's the issue I've got :
I have the habit to work in my
~/DEV
directory and to symlink relevant folders to the WordPress plugin directory. Withnpm run dev
everything is fine, but with a prodbuild
the URL of the main script is wrongly created.On this line, since I am working from another directory (ex:
/home/USER/DEV/wp-plugin-dev
), the$manifest_dir
has no overlap with$content_dir
so nothing get replaced.The computed URL looks like this :
https://wp.dev.local/wp-content/home/USER/DEV/wp-plugin-dev/app/dist
but should instead look like this :https://wp.dev.local/wp-content/wp-plugin-dev/app/dist
.Just to be clear, putting the actual root of the project in the WordPress
plugins
directory, so this issue should not really happen in real productions environments.How to reproduce
composer install && npm install && npm run build
main-XXXXX.js
is 404Hope it's clear enough!
The text was updated successfully, but these errors were encountered: