Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit ce9d2e4

Browse files
set vuejs prerender
1 parent 704f38a commit ce9d2e4

File tree

5 files changed

+225
-5
lines changed

5 files changed

+225
-5
lines changed

‎README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
springboot with vuejs (SPA)
1+
springboot with vuejs (Prerender)
22

33
sprignboot랑 연동하기
44

‎backend/build.gradle‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,15 @@ task resourcesCopy(dependsOn: ':frontend:npmBuild') {
4141
doLast {
4242
// copy template
4343
copy {
44-
from '../frontend/dist/index.html'
45-
into 'build/main/resources/templates'
44+
from ('../frontend/dist') {
45+
exclude 'static'
46+
}
47+
into 'build/resources/main/templates'
4648
}
4749
// copy static
4850
copy {
4951
from '../frontend/dist/static'
50-
into 'build/main/resources/static/static'
52+
into 'build/resources/main/static/static'
5153
}
5254
}
5355
}
@@ -64,4 +66,5 @@ task wrapper(type: Wrapper) {
6466
gradleVersion = gradleVersion
6567
}
6668

69+
//bootJar.dependsOn clean
6770
clean.dependsOn ':frontend:npmClean'

‎frontend/build/webpack.prod.conf.js‎

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ const HtmlWebpackPlugin = require('html-webpack-plugin')
1010
const ExtractTextPlugin = require('extract-text-webpack-plugin')
1111
const OptimizeCSSPlugin = require('optimize-css-assets-webpack-plugin')
1212
const UglifyJsPlugin = require('uglifyjs-webpack-plugin')
13+
const PrerenderSPAPlugin = require('prerender-spa-plugin')
1314

1415
const env = require('../config/prod.env')
1516

@@ -46,7 +47,7 @@ const webpackConfig = merge(baseWebpackConfig, {
4647
filename: utils.assetsPath('css/[name].[contenthash].css'),
4748
// Setting the following option to `false` will not extract CSS from codesplit chunks.
4849
// Their CSS will instead be inserted dynamically with style-loader when the codesplit chunk has been loaded by webpack.
49-
// It's currently set to `true` because we are seeing that sourcemaps are included in the codesplit bundle as well when it's `false`,
50+
// It's currently set to `true` because we are seeing that sourcemaps are included in the codesplit bundle as well when it's `false`,
5051
// increasing file size: https://github.com/vuejs-templates/webpack/issues/1110
5152
allChunks: true,
5253
}),
@@ -74,6 +75,15 @@ const webpackConfig = merge(baseWebpackConfig, {
7475
// necessary to consistently work with multiple chunks via CommonsChunkPlugin
7576
chunksSortMode: 'dependency'
7677
}),
78+
new PrerenderSPAPlugin({
79+
// Required - The path to the webpack-outputted app to prerender
80+
staticDir: config.build.assetsRoot,
81+
// Optional - The location of index.html
82+
indexPath: config.build.index,
83+
// Required - Routes to render.
84+
routes: ['/', '/hello', '/hello2'],
85+
86+
}),
7787
// keep module.id stable when vendor modules does not change
7888
new webpack.HashedModuleIdsPlugin(),
7989
// enable scope hoisting

‎frontend/package-lock.json‎

Lines changed: 206 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎frontend/package.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
"postcss-import": "^11.0.0",
4949
"postcss-loader": "^2.0.8",
5050
"postcss-url": "^7.2.1",
51+
"prerender-spa-plugin": "^3.0.0",
5152
"rimraf": "^2.6.0",
5253
"semver": "^5.3.0",
5354
"shelljs": "^0.7.6",

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /