angular - Webpack disable hashing of image name on output -
after building angular4 application, webpack changed image name bg_node_new.png
bg_node_new.3746bc3ac9b1bf77d2aff2c2df901a48.png
.
my webpack.config code is:
(function(module) { const path = require('path'); const npm_cmd = process.env.npm_lifecycle_event; const p = !(require('yargs').argv.p || false); let config; module.exports = function(env) { let cmds = npm_cmd.split(":"); const cmd = cmds.length >= 2 ? cmds[1] : null; const mod = cmds.length >= 3 ? cmds[2] : null; const aot = cmds.length >= 4 ? cmds[3] : null; const options = { p:!p, mod:mod, aot:aot, env:env, ngv:2, ctx:path.resolve(__dirname, "../../../../..") } //console.log(options); switch (cmd) { case 'app': console.log("building app"); config = require('./wp.app')(options); break; case 'lib': console.log("building lib"); config = require('./wp.lib')(options); break; case 'mod': console.log("building mod"); config = require('./wp.mod')(options); break default: console.log("building app"); config = require('./wp.app')(options); break; } return config; } })(module);
due this, image not rendering in app. how resolve issue?
thanks in advance!
updated after op's comment:
in wp.base.js
, remove [hash]
following:
const raw_file_loader = { test: /\.(png|jpe?g|gif|svg|woff|woff2|ttf|eot|ico|otf)$/, use: 'file-loader?name=assets/[name].[ext]' }
original answer:
if share webpack config, i'll ablr answer better. however, find config in webpack.config
,
{ test: /.*\.(gif|png|jpe?g|svg)$/i, use: [ { loader: 'file-loader', options: { name: '/images/[name]_[hash:7].[ext]', } }, ] }
... , remove [hash]
part. keep this:
name: '/images/[name].[ext]',
wiki
Comments
Post a Comment