But parcel always compile files recording to the relative path which is defined in server/views/assets, that means it has to be ../../../public/js/index.js.
So the only way I found is always using /js/index.js/js/detail.js instead.
Then I think maybe parcel-plugin-pug could nest this config for this compiling case. It will treat anything normal just like before, but when it meets some assets where the path start with /, it will know all the relative files is relative to public/.
Parcel-plugin-pug is really handy to use. However, when it comes to production, something inconvenient come out.
Here is the pug project:
In development:
In production:
But parcel always compile files recording to the relative path which is defined in server/views/assets, that means it has to be
../../../public/js/index.js
.So the only way I found is always using
/js/index.js
/js/detail.js
instead.Then I think maybe parcel-plugin-pug could nest this config for this compiling case. It will treat anything normal just like before, but when it meets some assets where the path start with
/
, it will know all the relative files is relative topublic/
.Here is the repo: https://github.com/huanglong/parcer-bundle-test