mirror of
https://github.com/terribleplan/next.js.git
synced 2024-01-19 02:48:18 +00:00
Update with-hashed-statics example (#5100)
* Add file-loader to webpack config * Fix lint problems
This commit is contained in:
parent
0bcee3c23f
commit
0fa642aacf
|
@ -1,13 +0,0 @@
|
|||
{
|
||||
"presets": ["next/babel"],
|
||||
"plugins": [
|
||||
[
|
||||
"transform-assets",
|
||||
{
|
||||
"extensions": ["txt", "svg", "png"],
|
||||
"regExp": ".*/static/(.+)",
|
||||
"name": "/static/[1]?[sha512:hash:base64:7]"
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
19
examples/with-hashed-statics/next.config.js
Normal file
19
examples/with-hashed-statics/next.config.js
Normal file
|
@ -0,0 +1,19 @@
|
|||
module.exports = {
|
||||
webpack: config => {
|
||||
config.module.rules.push({
|
||||
test: /\.(txt|jpg|png|svg)$/,
|
||||
use: [
|
||||
{
|
||||
loader: 'file-loader',
|
||||
options: {
|
||||
context: '',
|
||||
emitFile: true,
|
||||
name: '[path][name].[hash].[ext]'
|
||||
}
|
||||
}
|
||||
]
|
||||
})
|
||||
|
||||
return config
|
||||
}
|
||||
}
|
|
@ -9,5 +9,8 @@
|
|||
"next": "latest",
|
||||
"react": "16.2.0",
|
||||
"react-dom": "16.2.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"file-loader": "2.0.0"
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue