This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jest.mock('react-redux', () => ({ | |
connect: (mapStateToProps, mapDispatchToProps) => (reactComponent) => ({ | |
mapStateToProps, | |
mapDispatchToProps: (dispatch = mockDispatch, ownProps) => mapDispatchToProps(dispatch, ownProps), | |
reactComponent, | |
mockDispatch: jest.fn((action) => action) | |
}), | |
Provider: ({children}) => children | |
})); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
(function(d, script) { | |
script = d.createElement('script'); | |
script.type = 'text/javascript'; | |
script.async = true; | |
script.onload = function(){ | |
// remote script has loaded | |
}; | |
script.src = 'http://www.google-analytics.com/ga.js'; | |
d.getElementsByTagName('head')[0].appendChild(script); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Before </body> tag | |
<script> | |
var xhr = new XMLHttpRequest(); | |
xhr.open("get", "cookbook.js", true); | |
xhr.onreadystatechange = function () { | |
if (xhr.readyState == 4) { | |
if (xhr.status >= 200 && xhr.status < 300 || xhr.status == 304) { | |
var script = document.createElement("script"); | |
script.type = "text/javascript"; | |
script.text = xhr.responseText; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Loadable from 'react-loadable'; | |
export const ContactUs = Loadable({ | |
loader: () => import('./source/pages/ContactUs/ContactUs'), | |
loading: () => LoadingPage | |
}); | |
export const HomePage = Loadable({ | |
loader: () => import('./source/pages/Home/HomePage'), | |
loading: () => LoadingPage | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { Suspense } from 'react'; | |
const OtherComponent = React.lazy(() => import('./OtherComponent')); | |
function MyComponent() { | |
return ( | |
<div> | |
<Suspense fallback={<div>Loading...</div>}> | |
<OtherComponent /> | |
</Suspense> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const path = require('path'); | |
module.exports = { | |
entry: './path/to/my/entry/file.js', | |
output: { | |
filename: '[name].bundle.[contenthash].js' | |
}, | |
optimization: { | |
splitChunks: { | |
cacheGroups: { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const path = require('path'); | |
module.exports = { | |
entry: './path/to/my/entry/file.js', | |
output: { | |
path: path.resolve(__dirname, 'dist'), | |
filename: '[name].bundle.[contenthash].js', | |
}, | |
optimization: { | |
splitChunks: { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Your default webpacl config | |
const path = require('path'); | |
module.exports = { | |
entry: './path/to/my/entry/file.js', | |
output: { | |
path: path.resolve(__dirname, 'dist'), | |
filename: 'main-webpack.bundle.js' | |
} | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div> | |
<pre id="result"></pre> | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<RoutingRules> | |
<RoutingRule> | |
<Condition> | |
<KeyPrefixEquals/> | |
<HttpErrorCodeReturnedEquals>404</HttpErrorCodeReturnedEquals> | |
</Condition> | |
<Redirect> | |
<Protocol>https</Protocol> | |
<HostName>__YOUR_API_HOSTNAME_HERE__</HostName> | |
<ReplaceKeyPrefixWith>prod/resize?key=</ReplaceKeyPrefixWith> |
NewerOlder