Jump to content

How to recompile assets for PrestaShop backoffice?


Recommended Posts

Hi,

I'm trying to recompile the assets for my prestasho backoffice because I needed to take some adjustments in the javascript code to not hide a form once it has been saved. What I found is: https://devdocs.prestashop.com/1.7/development/compile-assets/. But I'm not able to do the npm install and npm run build commands. There is no package.json as in normal node projects. Additionally the above page states that as of prestashop 1.7.6 there should be a build.sh script in tools/assets. I was not able to find that script. I even downloaded a new 1.7.6.4 version and checked the tools folder, there is no assets folder inside.

Can you tell me how it is possible to rebuild the js assets, either without npm and nodejs or how I can set it up correctly to be able to run the npm run build command?

Kind RegardsAndi

Link to comment
Share on other sites

  • 2 years later...
  • 1 year later...

Hi there!

AFAIK you need to download the source code instead of the final build. Inside the source code you can find the needed files (.webpack/, package.json, webpack.config, etc)

For example. for the v1.7.6.7 I go to https://github.com/PrestaShop/PrestaShop/tags and look for the exact version.

Then, in the page of the release (https://github.com/PrestaShop/PrestaShop/releases/tag/1.7.6.7) download the source code.

Then, you need to have installed node.js (you can check in the doc page you mentined before: https://devdocs.prestashop-project.org/1.7/development/compile-assets/)
Because the v1.7 needs node.js 10.x and npm 5.x I choiced the node.js v10.0.0 (releases can be found here: https://nodejs.org/download/release/v8.10.0/)

After you install node.js open a new terminal/cmd console and run:

npm install

Then, if you're using Windows, you may have problems to run npm run build because it cannot resolve the NODE_DEV constant.

You can fix this issue  following the steps shown in this stack overflow page: https://stackoverflow.com/questions/57589183/passing-node-env-into-the-npm-script-for-windows-10

And at last (gosh) npm run build may work.

That worked for me right now.

Hope this help for other users who need to recompile their assets.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...