我已启用文件版本控制,并配置为将所有内容从/ assets / images路径导出到/ public / build / images,并且所有文件都有其自己的哈希值。理论上,manifest.json
是使用twig的{ {1}}函数必须使用非哈希文件名(与哈希文件对应的 )读取给定文件,但是它不起作用。它仍然仅显示哈希文件,为什么会发生?
asset
var Encore = require('@symfony/webpack-encore');
if (!Encore.isRuntimeEnvironmentConfigured()) {
Encore.configureRuntimeEnvironment(process.env.NODE_ENV || 'dev');
}
Encore
.setOutputPath('public/build/')
.setPublicPath('/build')
.addEntry('app','./assets/js/app.js')
.splitEntryChunks()
.enableSingleRuntimeChunk()
.cleanupOutputBeforeBuild()
.enableBuildNotifications()
.enableSourceMaps(!Encore.isProduction())
.enableVersioning()
.configureBabelPresetEnv((config) => {
config.useBuiltIns = 'usage';
config.corejs = 3;
})
.enableSassLoader()
.copyfiles({
from: './assets/images',to: 'images/[path][name].[hash:8].[ext]',})
;
module.exports = Encore.getWebpackConfig();
已正确配置:
Assets.yaml