WIP vue-cli 5

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel
2021-05-06 17:20:54 +02:00
parent 9f5e3a39ec
commit 3ff7bc4512
37 changed files with 2927 additions and 4101 deletions

View File

@@ -1,40 +1,20 @@
const path = require("path");
const ForkTsCheckerWebpackPlugin = require("fork-ts-checker-webpack-plugin");
const webpack = require("webpack");
module.exports = {
outputDir: path.resolve(__dirname, "../priv/static"),
configureWebpack: (config) => {
// Limit the used memory when building
// Source : https://stackoverflow.com/a/55810460/10204399
// get a reference to the existing ForkTsCheckerWebpackPlugin
const existingForkTsChecker = config.plugins.filter(
(p) => p instanceof ForkTsCheckerWebpackPlugin
)[0];
// remove the existing ForkTsCheckerWebpackPlugin
// so that we can replace it with our modified version
config.plugins = config.plugins.filter(
(p) => !(p instanceof ForkTsCheckerWebpackPlugin)
);
// copy the options from the original ForkTsCheckerWebpackPlugin
// instance and add the memoryLimit property
const forkTsCheckerOptions = existingForkTsChecker.options;
forkTsCheckerOptions.memoryLimit = process.env.NODE_BUILD_MEMORY || 2048;
config.plugins.push(new ForkTsCheckerWebpackPlugin(forkTsCheckerOptions));
config.plugins.push(
new webpack.DefinePlugin({
global: "window", // Placeholder for global used in any node_modules
})
);
config.node.global = false;
},
chainWebpack: (config) => {
// remove the prefetch plugin
config.plugins.delete("prefetch");
},
pwa: {
themeColor: "#ffd599", //not required for service worker, but place theme color here if manifest.json doesn't change the color
workboxPluginMode: "InjectManifest",
workboxOptions: {
// swSrc is required in InjectManifest mode.
swSrc: "./src/service-worker.ts",
// ...other Workbox options...
},
},
css: {
loaderOptions: {
scss: {