1
0
Fork 0
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:
Giovanni Giordano 2018-09-05 15:16:05 +02:00 committed by Tim Neutkens
parent 0bcee3c23f
commit 0fa642aacf
3 changed files with 22 additions and 13 deletions

View file

@ -1,13 +0,0 @@
{
"presets": ["next/babel"],
"plugins": [
[
"transform-assets",
{
"extensions": ["txt", "svg", "png"],
"regExp": ".*/static/(.+)",
"name": "/static/[1]?[sha512:hash:base64:7]"
}
]
]
}

View 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
}
}

View file

@ -9,5 +9,8 @@
"next": "latest",
"react": "16.2.0",
"react-dom": "16.2.0"
},
"devDependencies": {
"file-loader": "2.0.0"
}
}