Coder Social home page Coder Social logo

Comments (6)

MySecret avatar MySecret commented on July 17, 2024

dist/static/img/bg.jpg,但是我两个二级目录图片虽然同名,但是是不一样的两张图,这个为什么不能按模块来处理图片,都打包到同一个目录,名字一样就不行了

from vue-cli-multi-page.

huyongyong1992 avatar huyongyong1992 commented on July 17, 2024

请问解决了嘛?我也发现这个问题,不知如何修改配置

from vue-cli-multi-page.

jxp4531 avatar jxp4531 commented on July 17, 2024

需要在webpack针对图片的url-loader配置那里,加上hash

from vue-cli-multi-page.

634323580 avatar 634323580 commented on July 17, 2024

@jxp4531 可以配置做到每一个页面的图片单独放一个文件夹吗?

from vue-cli-multi-page.

zuishuanglin avatar zuishuanglin commented on July 17, 2024

@634323580 解决了吗?求指教

from vue-cli-multi-page.

RokoHuang avatar RokoHuang commented on July 17, 2024

@MySecret @huyongyong1992 @634323580 @zuishuanglin
在webpack.base.conf.js里的
module: {
rules: [
{//这是第三个
test: /.(png|jpe?g|gif|svg)(?.*)?$/,
loader: 'url-loader',
query: {
limit: 10000,
name: utils.assetsPath('img/[name].[ext]')
}
}
]
},里的name改成utils.assetsPath('img/[name].[hash:7].[ext]')
在打包后的每个img都会加上不同的hash,以此区分。单页面是这样处理的,此项目打包后文件均没有做缓存处理,被作者改过。

from vue-cli-multi-page.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.