bug: npm run build
produces non functioning app...
#370
Labels
bug
Something isn't working
pending-external-change
Requires work in Venus, Mqtt or other external systems
One of the recent commits 9bb3664 that I assume was supposed to reduce disk space and network traffic went wrong and broke the build.
Building the HTML5 app uses https://github.com/webpack-contrib/compression-webpack-plugin as a last step to compress files exceeding certain size.
The plugin works in a way where during the
npm run build
it leaves original files produced bywebpack
in place, and produces a.gz
versions of all files that exceed the threshold specified in webpack config:venus-html5-app/config/webpack.config.js
Lines 687 to 690 in 9bb3664
When using
deleteOriginalAssets: true
the plugin actually removes the uncompressed original files as they are not actually needed on the serverSo a directory produced with
deleteOriginalAssets: false
:Will look like this when
deleteOriginalAssets: true
is used:This all looks nice and shiny, until we realise there is
Problem 1: LICENSE.txt file gets deleted as well
We can see that it not only deleted the original
.js
file, but it also accidentally got rid of the.js.LICENSE.txt
file that gets shipped along... This is probably a bug in theCompressionPlugin
.Problem 2: Deleted original
.js
file does not get injected intoindex.html
There seems to be a race condition between the
CompressionPlugin
and theHtmlWebpackPlugin
whereHTMLWebpackPlugin
does not properly inject required.js
files into theindex.html
when they are removed by theCompressionPlugin
. This should not happen asCompressionPlugin
is mentioned last in ourwebpack.config
but it does happen.The result is that running either the
npm run build
ornpm run start
both result in an empty HTML5 app...Simple fix is to revert the commit 9bb3664.
More complex fix is to figure out how to make
CompressionPlugin
play well withHtmlWebpackPlugin
.The text was updated successfully, but these errors were encountered: