Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
N
next.js
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Alex
next.js
Commits
70d611f0
Commit
70d611f0
authored
Feb 27, 2019
by
JJ Kasper
Committed by
Tim Neutkens
Feb 27, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update with-hashed-statics example (#6472)
Fixes:
https://github.com/zeit/now-builders/issues/160
parent
227ea575
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
7 additions
and
7 deletions
+7
-7
file.txt
examples/with-hashed-statics/assets/file.txt
+1
-0
logo.png
examples/with-hashed-statics/assets/images/logo.png
+0
-0
logo.svg
examples/with-hashed-statics/assets/images/logo.svg
+0
-0
next.config.js
examples/with-hashed-statics/next.config.js
+2
-1
package.json
examples/with-hashed-statics/package.json
+1
-1
index.js
examples/with-hashed-statics/pages/index.js
+3
-5
file.txt
examples/with-hashed-statics/static/file.txt
+0
-0
No files found.
examples/with-hashed-statics/assets/file.txt
0 → 100644
View file @
70d611f0
Some cool text
\ No newline at end of file
examples/with-hashed-statics/
static
/images/logo.png
→
examples/with-hashed-statics/
assets
/images/logo.png
View file @
70d611f0
File moved
examples/with-hashed-statics/
static
/images/logo.svg
→
examples/with-hashed-statics/
assets
/images/logo.svg
View file @
70d611f0
File moved
examples/with-hashed-statics/next.config.js
View file @
70d611f0
...
@@ -7,7 +7,8 @@ module.exports = {
...
@@ -7,7 +7,8 @@ module.exports = {
loader
:
'file-loader'
,
loader
:
'file-loader'
,
options
:
{
options
:
{
context
:
''
,
context
:
''
,
emitFile
:
true
,
outputPath
:
'static'
,
publicPath
:
'_next/static'
,
name
:
'[path][name].[hash].[ext]'
name
:
'[path][name].[hash].[ext]'
}
}
}
}
...
...
examples/with-hashed-statics/package.json
View file @
70d611f0
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
"scripts"
:
{
"scripts"
:
{
"dev"
:
"next dev"
,
"dev"
:
"next dev"
,
"build"
:
"next build"
,
"build"
:
"next build"
,
"start"
:
"next"
"start"
:
"next
start
"
},
},
"dependencies"
:
{
"dependencies"
:
{
"babel-plugin-transform-assets"
:
"^0.2.0"
,
"babel-plugin-transform-assets"
:
"^0.2.0"
,
...
...
examples/with-hashed-statics/pages/index.js
View file @
70d611f0
// We need to use `require` instead of `import`
import
logoSVG
from
'../assets/images/logo.svg'
// They also must be assigned to a variable/constant
import
logoPNG
from
'../assets/images/logo.png'
const
logoSVG
=
require
(
'../static/images/logo.svg'
)
import
txt
from
'../assets/file.txt'
const
logoPNG
=
require
(
'../static/images/logo.png'
)
const
txt
=
require
(
'../static/file.txt'
)
export
default
()
=>
(
export
default
()
=>
(
<
div
>
<
div
>
...
...
examples/with-hashed-statics/static/file.txt
deleted
100644 → 0
View file @
227ea575
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment