Open sacr3dc0w opened 1 year ago
hi @sacr3dc0w , thanks. are you going to create PR for this? cc @jairo-bc
After making changes to our .js files, we noticed the changes were not being reflected in localhost or being pushed to our live site. We removed line 61 from webpack.common.js, and this did not fix the issue even n after a stencil bundle. Is there anything else we need to do to resolve this?
Steps on what to do after deleting line 61 would be much appreciated! Simply deleting the line isn't allowing for changes to js files to appear in local.
Upon further inspection and testing we discovered the following. We removed cleanOnceBeforeBuildPatterns: ['assets/dist'], and then removed our node_modules and dist folders. Upon runing npm install with this line now removed, when you stencil start, dist is not automatically created, after running stencil bundle dist is created. In order for js file changes to reflect you need to run stencil bundle again to see your changes and then start back up localhost. The root of the problem seems to be that Webpack Bundle Analyzer does not trigger on stencil start or on saving of a js file, so dist never gets updated causing the js to reflect as well. Is there going to be a further fix than just removing that line to get the functionality back similar to 6.7.0? Starting and stopping localhost to bundle is not ideal.
We can consider removing clean-webpack-plugin and use output.clean = true
https://github.com/johnagan/clean-webpack-plugin/issues/197
The code for our stores runs a lot of custom JavaScript and theme modifications. Since the 6.8.0 release (more specifically #2311), we were getting the TR-302 / 2500+ files, which meant pushing updates halted. We initially found a solution: delete assets/dist and node_modules, then reinstall and push the theme. I began to wonder why that was the solution, and if the assets/dist folder wasn't pruning stale files from between development and productions. Upon further investigation, I discovered the potential problem and have a possible solution.
Expected behavior
CleanWebpackPlugin removes files in the output.path directory and outputs new ones.
Actual behavior
New files are generated, but the old ones remain.
Steps to reproduce the behavior
Make sure Cornerstone is up-to-date (6.8.0)
Run
stencil start
, close that instance, then runstencil bundle
.User Notes / Suggested Solution
I believe this is due to the
cleanOnceBeforeBuildPatterns
setting: https://github.com/bigcommerce/cornerstone/blob/e400137638c254ad911ff667ba27cc61d7ecc278/webpack.common.js#L61Unless I'm misunderstanding, that setting doesn't appear to be necessary. From https://github.com/johnagan/clean-webpack-plugin/issues/106
All files inside webpack's output.path directory will be removed, but the directory itself will not be.
Below is an output from assets/dist with the settings as they are currently after I run
stencil start
. Looks normal. Scroll below to see the list of whenstencil bundle
is run after killing the local instance.BEFORE
AFTER
Now if we remove line 61 entirely, stale files are removed. https://github.com/bigcommerce/cornerstone/blob/e400137638c254ad911ff667ba27cc61d7ecc278/webpack.common.js#L61
BEFORE
AFTER