diff --git a/webpack.config.js b/webpack.config.js index 52cd8d4e3..eb65e332f 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -34,8 +34,8 @@ const packageVersion = packageJson.version; import faviconJson from './config/favicon.json' assert { type: 'json' }; async function webpackConfig() { - const wellKnownCacheDir = path.resolve(path.dirname('.cache/well-known')); - const assetsDirectory = path.resolve(path.dirname('assets')); + const wellKnownCacheDir = path.resolve('.cache/well-known'); + const assetsDirectory = path.resolve('assets'); let faviconApiVersion = undefined; if (!fs.existsSync(wellKnownCacheDir)) { @@ -192,7 +192,7 @@ async function webpackConfig() { let cachedVersion = undefined; - const versionFile = path.resolve(path.dirname('.well-known-cache'), `${cacheDigest}.version`); + const versionFile = path.resolve('.well-known-cache', `${cacheDigest}.version`); try { if (fs.existsSync(versionFile)) { cachedVersion = fs.readFileSync(versionFile, 'utf8'); @@ -209,14 +209,14 @@ async function webpackConfig() { return Array.from(langs).map(lang => { const faviconConfig = { versioning: { param_name: 'v', param_value: versionDigest.substr(0,10) }, ...langJsons[lang] }; - const cacheDirectory = path.resolve(path.dirname('.well-known-cache'), `${cacheDigest}-${lang}`); + const cacheDirectory = path.resolve('.well-known-cache', `${cacheDigest}-${lang}`); if (fs.existsSync(wellKnownCacheDir)) { console.log("Using favicons generated by nix"); return [ new CopyPlugin({ patterns: [ - { from: path.resolve(wellKnownCacheDir, lang), to: path.resolve(path.dirname('well-known'), lang) } + { from: path.resolve(wellKnownCacheDir, lang), to: path.resolve('well-known', lang) } ] }) ]; @@ -225,7 +225,7 @@ async function webpackConfig() { return [ new CopyPlugin({ patterns: [ - { from: cacheDirectory, to: path.resolve(path.dirname('well-known'), lang) } + { from: cacheDirectory, to: path.resolve('well-known', lang) } ] }) ]; @@ -237,23 +237,23 @@ async function webpackConfig() { return [ new RealFaviconPlugin({ faviconJson: path.relative(".", tmpobj.name), - outputPath: path.resolve(path.dirname('well-known'), lang), + outputPath: path.resolve('well-known', lang), inject: false }), new CopyPlugin({ patterns: [ - { from: 'config/robots.txt', to: path.resolve(path.dirname('well-known'), lang, 'robots.txt') }, + { from: 'config/robots.txt', to: path.resolve('well-known', lang, 'robots.txt') }, ] }), { apply: compiler => compiler.hooks.afterEmit.tap('AfterEmitPlugin', compilation => { - const imgFiles = glob.sync(path.resolve(path.dirname('well-known'), lang, '*.@(png)')); + const imgFiles = glob.sync(path.resolve('well-known', lang, '*.@(png)')); const imgFilesArgs = Array.from(imgFiles).join(" "); execSync(`exiftool -overwrite_original -all= ${imgFilesArgs}`, { stdio: 'inherit' }); }) }, { apply: compiler => compiler.hooks.afterEmit.tap('AfterEmitPlugin', compilation => { - fs.ensureDirSync(path.dirname('.well-known-cache')); - fs.copySync(path.resolve(path.dirname('well-known'), lang), cacheDirectory); + fs.ensureDirSync('.well-known-cache'); + fs.copySync(path.resolve('well-known', lang), cacheDirectory); if (!fs.existsSync(versionFile)) { fs.writeFileSync(versionFile, faviconApiVersion, { encoding: 'utf8' }); } @@ -268,7 +268,7 @@ async function webpackConfig() { output: { chunkFilename: '[chunkhash].js', filename: '[chunkhash].js', - path: path.resolve(path.dirname('static'), `wp-${webpackVersion}`), + path: path.resolve('static', `wp-${webpackVersion}`), publicPath: `/static/res/wp-${webpackVersion}/`, hashFunction: 'shake256', hashDigestLength: 36