In this talk you will learn:
How to structure your JS-heavy project in Salesforce DX
How to structure your JS-heavy project in Salesforce DX
Learn how to use all the familiar JS tools with Webpack and Lightning
chaitra-1.pptx fake news detection using machine learning
Â
Locker Service Ready Lightning Components With Webpack
1. Locker Service Ready Lightning
Components With Webpack
Writing modern JavaScript with dependencies
in a safe and platform-compatible way
marat@salesforce.com, @MaratVy
Marat Vyshegorodtsev, Lead Application Security Engineer
2. In this talk you will learn
How to structure your JS-heavy project in Salesforce DX
Artifacts!
How to build Locker Service-compatible JS bundles using Webpack
You may know Webpack from ReactJS development, but it is not its only use!
Learn how to use all the familiar JS tools with Webpack and Lightning
Linting, depolyfilling and more!
7. What is my modern Salesforce stack in 2017?
Salesforce Developer Experience (DX)
Source-driven deployments a la Heroku
Lightning + Salesforce Design System + Locker + Stricter CSP Critical Update
Enable all usability and security features
ECMAScript 6+ with Webpack 3 + Babel + ESLint with Salesforce rules
Modern JavaScript development with freedom to choose the libraries
Bleeding edge platform technologies
11. Webpack Configuration for Lightning
Output two static resources: App.resource and Styles.resource
Package code as a library with window library target
Fix all Locker-broken imports: global variables, this instead of window
Lint code for Lightning issues
Transpile ES6+ to browser-compatible JS
16. Fix UMD and AMD Imports
Webpack wraps UMD call to this nicely so that libraries like Choices.js just work
For AMD packages disable define using imports-loader:
imports-loader?define=>false
17. Transpile Modern JS to Browser-Compatible
Use babel-loader with babel-preset-env
In package.json configure:
“browserlist”: “last 2 versions”
https://sfdc.co/browsers
18. Check for Lightning Issues in JS
Use eslint-loader with @salesforce/eslint-plugin-aura in .eslintrc
21. Check out my VisualForce work too!
@salesforce/eslint-plugin-visualforce
forcedotcom/eslint-plugin-visualforce
22. Attend these theater sessions today!
1:30pm Common Web Security Vulnerabilities and Their Fixes
Learn more about Open Redirect and XSS
2:00pm Avoiding Common Security Mistakes
Learn more about SOQL injection and CSRF
Editor's Notes
No browser detection for polyfill breaks the proper CustomEvent object in SecureWindow object.
Just search for CustomEvent in the source code given the error from the previous slide