Javascript

We use gulp for managing multiple tasks..

To compile the javascript only

yarn run js

If you want to import a javascript file all you have to do is put it inside of the js folder

Folder Location

Project
    assets
        js
            regularJS.js

Add an Entry Point in Webpack.config.js

entry: {
    //[name of output file]: './assets/js/[name of file]',
    regularJS: './assets/js/regularJS.js',
    vendor: VENDOR_LIBS
  }

If Using NodeJS Packages Add to Vendor List in webpack.config.js

const VENDOR_LIBS = [
  'redux', 'react-redux', 'react-dom'
]

On HTML or Dynamic Page

Make sure to have vendors above all the other javascript files that depend on them.

<script src="js/components/vendor.js"></script>
<script src="js/components/firstComp.js"></script>

results matching ""

    No results matching ""