mirror of
https://github.com/Findus23/lw1.at.git
synced 2024-09-12 07:33:45 +02:00
don't prerender in tests
This commit is contained in:
parent
d3e0ef5a9e
commit
808697e99b
1 changed files with 42 additions and 37 deletions
|
@ -2,7 +2,6 @@ import * as webpack from "webpack";
|
|||
import merge from "webpack-merge";
|
||||
import common from './webpack.common';
|
||||
import {LicenseWebpackPlugin} from "license-webpack-plugin";
|
||||
import SriPlugin from 'webpack-subresource-integrity';
|
||||
// @ts-ignore
|
||||
import PrerenderSPAPlugin from 'prerender-spa-plugin';
|
||||
import CompressionPlugin from 'compression-webpack-plugin';
|
||||
|
@ -12,6 +11,47 @@ import * as path from 'path';
|
|||
|
||||
const PuppeteerRenderer = PrerenderSPAPlugin.PuppeteerRenderer;
|
||||
|
||||
const plugins = [
|
||||
// new SriPlugin({
|
||||
// hashFuncNames: ["sha256"],
|
||||
// enabled: true
|
||||
// }),
|
||||
new LicenseWebpackPlugin({
|
||||
// perChunkOutput: false
|
||||
licenseTextOverrides: {
|
||||
blurhash: 'MIT'
|
||||
}
|
||||
}) as any,
|
||||
new CleanWebpackPlugin(),
|
||||
// new CopyWebpackPlugin({patterns: [{from: "icon", to: "icon"}]}),
|
||||
// new CopyWebpackPlugin({patterns: [{from: "licenses.txt", to: "licenses.txt"}]}),
|
||||
new webpack.LoaderOptionsPlugin({
|
||||
minimize: true
|
||||
}),
|
||||
new MiniCssExtractPlugin({
|
||||
filename: "[name].[contenthash].css",
|
||||
chunkFilename: "[id].[contenthash].css"
|
||||
}),
|
||||
new CompressionPlugin({
|
||||
test: /\.(js|css|html)/
|
||||
}),
|
||||
];
|
||||
|
||||
if (process.env.PRERENDER !== 'disabled') {
|
||||
plugins.push(new PrerenderSPAPlugin({
|
||||
staticDir: path.join(__dirname, 'dist'), // The path to the folder where index.html is.
|
||||
routes: require("./routes"), // List of routes to prerender.
|
||||
renderer: new PuppeteerRenderer({
|
||||
headless: true,
|
||||
inject: {
|
||||
prerender: true
|
||||
},
|
||||
maxConcurrentRoutes: 4,
|
||||
}),
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
const config: webpack.Configuration = merge(common, {
|
||||
mode: "production",
|
||||
|
@ -23,42 +63,7 @@ const config: webpack.Configuration = merge(common, {
|
|||
moduleIds: "deterministic"
|
||||
},
|
||||
devtool: "source-map",
|
||||
plugins: [
|
||||
// new SriPlugin({
|
||||
// hashFuncNames: ["sha256"],
|
||||
// enabled: true
|
||||
// }),
|
||||
new LicenseWebpackPlugin({
|
||||
// perChunkOutput: false
|
||||
licenseTextOverrides: {
|
||||
blurhash: 'MIT'
|
||||
}
|
||||
}) as any,
|
||||
new CleanWebpackPlugin(),
|
||||
// new CopyWebpackPlugin({patterns: [{from: "icon", to: "icon"}]}),
|
||||
// new CopyWebpackPlugin({patterns: [{from: "licenses.txt", to: "licenses.txt"}]}),
|
||||
new webpack.LoaderOptionsPlugin({
|
||||
minimize: true
|
||||
}),
|
||||
new MiniCssExtractPlugin({
|
||||
filename: "[name].[contenthash].css",
|
||||
chunkFilename: "[id].[contenthash].css"
|
||||
}),
|
||||
new CompressionPlugin({
|
||||
test: /\.(js|css|html)/
|
||||
}),
|
||||
new PrerenderSPAPlugin({
|
||||
staticDir: path.join(__dirname, 'dist'), // The path to the folder where index.html is.
|
||||
routes: require("./routes"), // List of routes to prerender.
|
||||
renderer: new PuppeteerRenderer({
|
||||
headless: true,
|
||||
inject: {
|
||||
prerender: true
|
||||
},
|
||||
maxConcurrentRoutes: 4,
|
||||
}),
|
||||
})
|
||||
]
|
||||
plugins: plugins
|
||||
});
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue