topcoder-platform / admin-app

Customer support application
7 stars 25 forks source link

"npm run build" should never broke a build #190

Open maxceem opened 3 years ago

maxceem commented 3 years ago

At the moment when we build the app using "npm run build" the resulting built is broken. This happens because building script is concatenating the source code into a single file, and removes new lines, which can lead to the situations, when some code became broken because of the concatenation.

See issue we had:

the issue was because of using self-called function pattern https://github.com/topcoder-platform/admin-app/blob/dev/src/components/track-icon/track-icon.directive.js#L20 We already had such a code, but in the challenge second directive was added. So when they are merged into a single file, without ; compiler misunderstand our intention, and is trying to call some code which is not a function, because it sees (...) after it. (edited)

image

image

For now, to fix such issue we added ; manually in the directive files, see for example:

We have fix the building script so the source code doesn't get broken after modification, even if don't add ; in the source code in such places.

To test the build we can host dist folder using any static files server, for example:

npm run build
cd dist
npx http-server