Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
config.plugins.push(
new PrerenderSPAPlugin({
// Required - The path to the webpack-outputted app to prerender.
staticDir: path.join(__dirname, 'build'),
// Required - Routes to render.
routes: routes.map(({ path }) => path),
// Make prerendering more stable
renderer: new Renderer({
maxConcurrentRoutes: 1,
renderAfterTime: 1000
})
})
)
config.plugins.push(
new SitemapPlugin(hero.url, routes, {
lastMod: true,
changeFreq: 'weekly'
})
)
config.plugins.push(
new HtmlWebpackPlugin({
feed: {
url: hero.url,
title: hero.title,
subtitle: hero.description,
entries: posts.map(feedMapper).reverse()
},
template: 'public/atom.html',
filename: 'atom.xml',
inject: false,
}
// Generate manifest.json if set in config
if (manifestConfig) {
webpackConfig.plugins.push(new WebappManifestPlugin(manifestConfig))
}
// Generate robots.txt
if (robotsTxtConfig && robotsTxtConfig.host && robotsTxtConfig.policy) {
webpackConfig.plugins.push(new RobotstxtPlugin(robotsTxtConfig))
}
// Generate sitemap.xml
if (sitemapConfig && sitemapConfig.base) {
webpackConfig.plugins.push(
new SitemapPlugin(
sitemapConfig.base,
sitemapConfig.paths,
sitemapConfig.options
)
)
}
if (config.build.productionGzip) {
const CompressionWebpackPlugin = require('compression-webpack-plugin')
webpackConfig.plugins.push(
new CompressionWebpackPlugin({
asset: '[path].gz[query]',
algorithm: 'gzip',
test: new RegExp(
'\\.(' +
]),
!prod && new webpack.HotModuleReplacementPlugin(),
prod && new webpack.optimize.AggressiveSplittingPlugin(),
// prod && new GenerateSW({
// skipWaiting: true,
// clientsClaim: true,
// runtimeCaching: [{
// urlPattern: new RegExp(env.SITE_URL),
// handler: 'staleWhileRevalidate',
// }],
// navigateFallback: '/',
// navigateFallbackWhitelist: [/^(?!\/__).*/],
// cacheId: pkg.name,
// }),
prod && new RobotstxtPlugin(),
prod && new SitemapPlugin(env.SITE_URL, [{ path: '/' }]),
].filter(Boolean),
optimization: {
splitChunks: {
cacheGroups: {
common: {
name: 'common',
chunks: 'initial',
minChunks: 2,
},
vendor: {
test: /[\\/]node_modules[\\/]/,
name: 'vendor',
chunks: 'all',
},
},
},
if (filename !== '404.html') {
paths.push(filename);
}
return new HTMLWebpackPlugin({
filename,
template: path.join(config.root, config.paths.src, filename),
meta: {
viewport: config.viewport,
},
});
});
// Sitemap
const sitemap = new SitemapPlugin(config.site_url, paths, {
priority: 1.0,
lastmodrealtime: true,
});
// Favicons
const favicons = new WebappWebpackPlugin({
logo: config.favicon,
prefix: 'images/favicons/',
favicons: {
appName: config.site_name,
appDescription: config.site_description,
developerName: null,
developerURL: null,
icons: {
android: true,
appleIcon: true,
name: '/fonts/[name].[ext]',
mimetype: 'application/font-otf',
outputPath: 'static'
}
}
]
},
plugins: [
new HtmlWebpackPlugin({
template: 'src/index.html',
filename: 'index.html'
}),
new MiniCssExtractPlugin({ filename: 'static/[name].[hash].css' }),
new CopyWebpackPlugin([{ from: 'assets', to: './static' }]),
new RobotstxtPlugin(),
new SitemapPlugin('https://sequelizeui.app', ['/'], { lastMod: true })
]
}
exports.generateRenderPlugins = () => {
let paths = getDocumentRoutes()
let distPath = path.join(__dirname, './../dist-docs')
return [
new PrerenderSpaPlugin({
staticDir: distPath,
routes: paths,
renderer: new Renderer({
maxConcurrentRoutes: 5
})
}
),
new SitemapPlugin(
'https://uiv.wxsm.space',
paths.map(path => path === '/' ? path : path + '/'),
{
changeFreq: 'weekly'
}
)
]
}
routes: staticPaths,
renderer: new Renderer({
maxConcurrentRoutes: 5
})
}
),
new PrerenderSpaPlugin({
staticDir: distPath,
routes: ajaxPaths,
renderer: new Renderer({
renderAfterElementExists: '#post-content',
maxConcurrentRoutes: 5
})
}
),
new SitemapPlugin('https://wxsm.space', [].concat(staticPaths, ajaxPaths), {
skipGzip: true,
changeFreq: 'weekly'
})
]
}
persistentCache: true,
title: 'FindETH',
icons: {
favicons: false
}
}),
new CspHtmlWebpackPlugin({
'default-src': `'none'`,
'script-src': `'self' https://analytics.mycryptoapi.com`,
'style-src': `'unsafe-inline'`,
'img-src': `'self' data: https://analytics.mycryptoapi.com`,
'font-src': `'self'`,
'connect-src': `https://api.mycryptoapi.com/eth https://mainnet.infura.io https://api.etherscan.io`,
'frame-src': `'self' https://connect.trezor.io/`
}),
new SitemapWebpackPlugin('https://findeth.io', SITEMAP_PATHS),
new RobotsPlugin({
policy: [
{
userAgent: '*',
allow: '/',
disallow: '/search'
}
],
sitemap: 'https://findeth.io/sitemap.xml'
})
]
};
export default smart(common, configuration);