phabelio/phabel

Path to static assets are broken

Closed this issue · 2 comments

When transpiling, library vendor/foo/bar will be now accessible under vendor/phabel/transpiler71/foo/bar. This is a problem when this library has static assets, such as .js or .css files, which are referenced directly.

For instance, my plugin accesses assets like this:

$cssFile = $mainPluginURL . 'vendor/graphql-by-pop/graphql-clients-for-wp/build/static/css/main.css';

After transpiling, this code must be fixed:

$cssFile = $mainPluginURL . 'vendor/phabel/transpiler71/graphql-by-pop/graphql-clients-for-wp/build/static/css/main.css';

Maybe this is related to #10, as to enable developers to add custom hooks to fix these issues.

danog commented

I imagined some packages might have issues with this, I guess I'll just have to create a symlink from the original path to the transpiled path.

danog commented

Now the transpiled packages are copied to the original path, too.
Symlinking is a bit more problematic, since it's broken on Windows, and composer has some issues with it anyway due to the lack of cleanup logic, still have to figure out how to stuff it into composer (somewhat related to #8).