mirror of
https://github.com/nuxt/nuxt.git
synced 2025-02-06 21:10:38 +00:00
Use getFilename for url-loader assets (#3759)
Now they get [name] removed in production.
This commit is contained in:
parent
432720b8c8
commit
715df92eac
@ -49,7 +49,7 @@ export default class WebpackBaseConfig {
|
|||||||
// Don't use hashes when watching
|
// Don't use hashes when watching
|
||||||
// https://github.com/webpack/webpack/issues/1914#issuecomment-174171709
|
// https://github.com/webpack/webpack/issues/1914#issuecomment-174171709
|
||||||
if (this.options.dev) {
|
if (this.options.dev) {
|
||||||
fileName = fileName.replace(/\[(chunkhash|contenthash|hash)\]\./g, '')
|
fileName = fileName.replace(/\[(chunkhash|contenthash|hash)(?::(\d+))?\]\./g, '')
|
||||||
}
|
}
|
||||||
|
|
||||||
// Don't use [name] for production assets
|
// Don't use [name] for production assets
|
||||||
@ -185,7 +185,7 @@ export default class WebpackBaseConfig {
|
|||||||
loader: 'url-loader',
|
loader: 'url-loader',
|
||||||
options: {
|
options: {
|
||||||
limit: 1000, // 1KO
|
limit: 1000, // 1KO
|
||||||
name: 'img/[name].[hash:7].[ext]'
|
name: this.getFileName('img')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
@ -195,7 +195,7 @@ export default class WebpackBaseConfig {
|
|||||||
loader: 'url-loader',
|
loader: 'url-loader',
|
||||||
options: {
|
options: {
|
||||||
limit: 1000, // 1 KO
|
limit: 1000, // 1 KO
|
||||||
name: 'fonts/[name].[hash:7].[ext]'
|
name: this.getFileName('font')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
@ -204,7 +204,7 @@ export default class WebpackBaseConfig {
|
|||||||
use: perfLoader.pool('assets', {
|
use: perfLoader.pool('assets', {
|
||||||
loader: 'file-loader',
|
loader: 'file-loader',
|
||||||
options: {
|
options: {
|
||||||
name: 'videos/[name].[hash:7].[ext]'
|
name: this.getFileName('video')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -53,7 +53,10 @@ export default {
|
|||||||
filenames: {
|
filenames: {
|
||||||
app: '[name].[contenthash].js',
|
app: '[name].[contenthash].js',
|
||||||
chunk: '[name].[contenthash].js',
|
chunk: '[name].[contenthash].js',
|
||||||
css: '[name].[contenthash].css'
|
css: '[name].[contenthash].css',
|
||||||
|
img: 'img/[name].[hash:7].[ext]',
|
||||||
|
font: 'fonts/[name].[hash:7].[ext]',
|
||||||
|
video: 'videos/[name].[hash:7].[ext]'
|
||||||
},
|
},
|
||||||
styleResources: {},
|
styleResources: {},
|
||||||
plugins: [],
|
plugins: [],
|
||||||
|
Loading…
Reference in New Issue
Block a user