adobe / aem-project-archetype

Maven template to create best-practice websites on AEM.
https://experienceleague.adobe.com/docs/experience-manager-core-components/using/developing/archetype/overview.html
Apache License 2.0
547 stars 423 forks source link

npm run watch deletes clientlib-site/css & /js in Archetype 39 #1003

Open SatoshiInoue opened 1 year ago

SatoshiInoue commented 1 year ago

Expected Behaviour

Running npm run watch, it should deploy a new version of the frontend css/js to the author instance.

Actual Behaviour

Running npm run watch, that is "watch": "npm-run-all --parallel start chokidar aemsyncro", it deletes /apps/{package id}/clientlibs/clientlib-site/css/ and /js/ from the running author instance.

To temporarily resolve the issue, I run webpack-dev-server -- ./webpack.dev.js --env writeToDisk & chokidar -c \"clientlib\" ./dist & aemsync -w ../ui.apps/src/main/content and this re-deploys a new version of the css/js.

Reproduce Scenario (including but not limited to)

Steps to Reproduce

Platform and Version

Archetype ver 39

Sample Code that illustrates the problem

Logs taken while reproducing problem

kevinolivar commented 1 year ago

Hi there,

better late than never. I don't think it is an issue.

Just for clarification, webpack-dev-server serves from memory. Meaning, it won't serve static files, meaning the dist folder won't be generated. If you still want that, you should run first npm run prod or npm run dev with webpack. OR, as you did, use the option writeToDisk.

Alternatively, you could run webpack --watch and it will build and write to the disk.

This is the command, I am using, webpack --env development --watch --config ./webpack.dev.js & chokidar -c \"clientlib\" ./dist & aemsync -w ../ui.apps/src/main/content

Regarding, the deletion, webpack.common.js uses a plugin CleanWebpackPlugin (https://www.npmjs.com/package/clean-webpack-plugin) for cleaning the build folder.

Hope this answers your above question. If so, I would say this can be closed.