Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds Webpack configuration for bundling our JavaScript #252

Open
wants to merge 4 commits into
base: development
Choose a base branch
from

Conversation

rderik
Copy link
Contributor

@rderik rderik commented May 12, 2020

References #251

This commit includes the basic configuration for Yarn and Webpack to provide minification of our JavaScript code and in the future support for modern JavaScript through transpilation with Babel.

@rderik rderik requested a review from glassjoseph May 12, 2020 15:33
Using Webpack module bunlder we are now able to minify the JavaScript
files. We would need to change the structure of our JavaScript source
files in the future but at the moment we'll generate the new minified
JavaScript and add it to `virtualhosts/www/javascript/`.

The current setup, doesn't require any change on our JavaScript only
changes in the directory structure.
Configured Webpack to export a library with exports on the `window`
object so the scripts' exported functions and variables are accessible
on the global scope. By doing this we avoid changing the inline scripts
on the HTML templates.

TODO: Add production configuration to Webpack.
We are now able to generate a minified version for production and
development for our JavaScript files. The development script leaves
keeps a watch on the files, if anything changes Webpack updates the
files so we don't have to regenerate them manualy while developing.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant