You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have the problem that resources that are loaded from the (s)css are not rendered with the [git-revision-hash].
However, only when I am in normal webpack build mode.
When I start webpack --watch everything works.
so webpack (build) => url(/assets/fonts/myFont-Regular.[git-revision-hash].woff2) format("woff2"),
and webpack --watch => url(/assets/fonts/myFont-Regular.946a26b9.woff2) format("woff2"),
I am attaching the webpack.config. Maybe someone can help me further.
'use strict';constpath=require('path');constwebpack=require('webpack');constpackageJSON=require('./package.json');constMiniCssExtractPlugin=require('mini-css-extract-plugin');constCssMinimizerPlugin=require('css-minimizer-webpack-plugin');constImageMinimizerPlugin=require('image-minimizer-webpack-plugin');constCopyPlugin=require('copy-webpack-plugin');constFantasticonPlugin=require('fantasticon-webpack-plugin');const{GitRevisionPlugin}=require('git-revision-webpack-plugin');module.exports={target: 'web',mode: process.env.APP_ENV==='production' ? 'production' : 'development',devtool: process.env.APP_ENV==='production' ? false : 'inline-source-map',entry: {main: [path.resolve(__dirname,'./src/assets/scripts/main.js'),path.resolve(__dirname,'./src/assets/styles/main.scss'),],// workaround to copy fonts into dist folder - do not remove until we find a proper way!// ignore fonts.css in dist folder!fonts: path.resolve(__dirname,'./src/assets/styles/fonts.scss')},output: {path: path.resolve(__dirname,'./dist'),publicPath: packageJSON.project.publicPath+'/',filename: 'js/[name].[git-revision-hash].js',clean: true,},module: {rules: [{test: /\.js$/,exclude: /node_modules/,use: {loader: 'babel-loader',options: {presets: ['@babel/preset-env'],},},},{test: /\.s[ac]ss$/i,use: [MiniCssExtractPlugin.loader,'css-loader',{loader: 'postcss-loader',options: {postcssOptions: {// https://github.com/csstools/postcss-plugins/tree/main/plugin-packs/postcss-preset-env// the stage option determines which CSS features to polyfill// disable every polyfill: false// stable: 4plugins: [['postcss-preset-env',{stage: 4}]],},},},'sass-loader',],},// svg: created as data url/*{ test: /\.svg$/i, type: 'asset/inline' },*/{test: /\.(png|jpg|gif)$/,type: 'asset/resource',generator: {filename: 'images/[name].[git-revision-hash][ext]',},},{test: /\.svg$/i,type: 'asset/resource',generator: {filename: 'vectors/[name][ext]',},// https://webpack.js.org/plugins/image-minimizer-webpack-plugin/#standalone-loader},{test: /\.(woff|woff2)$/,type: 'asset/resource',generator: {filename: 'fonts/[name].[git-revision-hash][ext]',},},],},resolve: {alias: {'@': path.resolve(__dirname,'./src'),toolbox: path.resolve(__dirname,'./src/assets/scripts/utilities/toolbox'),},extensions: ['.sass','.scss','.css','.wasm','.web.js','.mjs','.js','.json','.web.jsx','.svg','.png','.jpg','.webp','.jpeg','.jsx','.woff','.woff2',],},plugins: [newGitRevisionPlugin({commithashCommand: 'rev-parse --short HEAD',}),newCopyPlugin({patterns: [{from: '**/*.svg',to: '../src/patterns/fundamentals/vectors/v-[name].hbs',context: 'src/assets/vectors',},{from: '**/*.hbs',to: 'patterns/',context: 'src/patterns',},{from: '**/*.*',to: 'images/',context: 'src/assets/images',},],}),newFantasticonPlugin({runOnComplete: false,//optional//onComplete: (fontConfig) => {}, //optional//configPath: 'myconfig.js', //optional//config: { ... } //optional}),newMiniCssExtractPlugin({filename: 'css/[name].[git-revision-hash].css',}),newwebpack.ProvidePlugin({$: 'jquery',jQuery: 'jquery',toolbox: 'toolbox',}),],optimization: {minimizer: ['...',// keep the existing minimizer of webpack, which is terser (minimizes js files)newCssMinimizerPlugin({// css optimization only in production mode// https://webpack.js.org/plugins/css-minimizer-webpack-plugin/#remove-all-commentsminimizerOptions: {preset: ['default',{discardComments: {removeAll: true},},],},}),newImageMinimizerPlugin({minimizer: {implementation: ImageMinimizerPlugin.svgoMinify,options: {encodeOptions: {// Pass over SVGs multiple times to ensure all optimizations are applied. False by defaultmultipass: true,plugins: [// set of built-in plugins enabled by default// see: https://github.com/svg/svgo#default-preset{name: 'preset-default',params: {overrides: {// customize default plugin optionsinlineStyles: {onlyMatchedOnce: false,},// or disable pluginsremoveDoctype: false,cleanupIDs: false,},},},{name: 'prefixIds',},],},},},}),],},};
The text was updated successfully, but these errors were encountered:
Hi,
I have the problem that resources that are loaded from the (s)css are not rendered with the [git-revision-hash].
However, only when I am in normal webpack build mode.
When I start webpack --watch everything works.
so webpack (build) => url(/assets/fonts/myFont-Regular.[git-revision-hash].woff2) format("woff2"),
and webpack --watch => url(/assets/fonts/myFont-Regular.946a26b9.woff2) format("woff2"),
I am attaching the webpack.config. Maybe someone can help me further.
The text was updated successfully, but these errors were encountered: