Closed alecslupu closed 1 year ago
At decidim we pass through a major redesign process, in which we have ended up replacing the WYSIWYG from QuillJS to Tip-tap, change that led to have some specs. We also, changed our tag system from foundation-datapicker to tom-select.
While working with the dev-server we could not see any issue. We did not see any issues either when running in CI the specs, as there was no NODE_ENV variable being set. We only had "RAILS_ENV".
One of my colleagues tried to run the editor specs locally, case when observed that the specs were failing. I could observe, while investigating on my end, that my script actually was failing with:
packs-test/js/1230.js 1:12730 Uncaught SyntaxError: Invalid regular expression: /ß|€|â||„|ˆ|•|±|¥|É| "
During my investigation, i could observe that 'rake webpacker:compile' and the asset compiling during the test are behaving differently.
The Invalid regular expression error, is being caused by tom-select dependency @orchidjs/unicode-variants, and it seems that the compiler is actually replacing accent_pat
from
const convert_pat = new RegExp(Object.keys(latin_convert).join('|') + '|' + accent_pat, 'gu');
to
new RegExp(Object.keys(j).join("|")+"|[̀-ͯ·ʾʼ]","gu")
I could observe in my specs that i had a node_env variable that was being set, but removing it, would have no effect.
I ended up, overriding the webpackConfig variable in my config.js to always use the TerserPlugin on all the environments, as being defined in https://github.com/shakacode/shakapacker/blob/master/package/environments/production.js , which in the end fixed the above issue.
@alecslupu if you want a custom NODE_ENV, then why not just set it before running the scripts that invoke this command?
Closed as #366 is also closed.
Notice: A bug is a crash or incorrect behavior. If you have a debugging or troubleshooting question, please open a discussion on the Discussions Tab. Otherwise, remove this line and fill out the following sections.
Expected behavior:
Asset compilation should respect the RAILS environment in which the assets are being compiled.
Actual behavior:
Currently the behavior varies on multiple factors.
Running the command :
will compile the js assets generating the following structure:
Running
will compile the js assets generating the following structure:
Running the following command
will generate a lot of files that follow the previous response.
Running the following command
will generate the files having the following structure:
our
shackapacker.yml
( generated)Small, reproducible repo:
https://github.com/decidim/decidim ( branch chore/upgrade-shakapacker )
Setup environment: