Creating a Locker Service-compliant JavaScript bundle using webpack

So far, we have been lucky that our JavaScript libraries have worked perfectly under Locker Service. There are libraries that may not work under Locker Service due to their use of unsupported elements. All the window, Document, and DOM APIs that are supported by locker are listed at http://documentation.auraframework.Org/lockerApiTest/index.app?aura.mode=DEV.

If you are using the this keyword in JavaScript for window reference, then note that the Lightning Component framework does not support it, and has to explicitly use window.

Webpack is a module bundler that allows us to transform the source code and bundle it. We can use the power of webpack to create a static resource file that is optimized and takes care of unsupported references in the library. Before we deep dive into how to use the webpack bundler, let's dive into the basics of webpack in the following section.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.188.61.81