Files
web2.0-frontend/configs/webpack/prod.js
T
2018-06-21 10:40:14 +03:00

34 lines
1.1 KiB
JavaScript

// production config
const merge = require('webpack-merge');
const path = require('path')
const resolve = path.resolve;
const DynamicCdnWebpackPlugin = require('dynamic-cdn-webpack-plugin');
const PrerenderSPAPlugin = require('prerender-spa-plugin');
/* NOTE: This is a list of all routes that are prerendered for production use.
Please list all routes that contain search engine accessible content, i.e.,
stuff that you would like to find with a Google Search. */
const PRERENDERED_ROUTES = ["/", "/404"];
const commonConfig = require('./common');
module.exports = merge(commonConfig, {
mode: 'production',
entry: './index.tsx',
output: {
filename: 'js/bundle.[hash].min.js',
path: resolve(__dirname, '../../dist'),
publicPath: '/',
},
devtool: 'source-map',
plugins: [
new DynamicCdnWebpackPlugin(),
new PrerenderSPAPlugin({
// Required - The path to the webpack-outputted app to prerender.
staticDir: resolve(__dirname, '../../dist'),
// Required - Routes to render.
routes: PRERENDERED_ROUTES,
})
],
});