๊ณต์ ๋ฌธ์์ ๋ฐ๋ฅด๋ฉด
'dva / router'์์ {browserHistory} ๊ฐ์ ธ ์ค๊ธฐ;
// 1. ์ด๊ธฐํ
const ์ฑ = dva ({
์ญ์ฌ : browserHistory,
});
์ด๊ฒ์ ์ ์์ด์ง๋ง ์ก์ธ์ค ๊ฒฝ๋ก ์๋์ ๋ค๋ฅธ ํ์ด์ง๋ฅผ ์ฐพ์ ์ ์์ต๋๋ค.
URL์ #์๊ฐ ์์ผ๋ฉด ์ ์์
๋๋ค.์กฐ์ธํ์ญ์์ค
browserHistory๋ฅผ ์ฌ์ฉํ ํ ์๋ฒ๋ ํฌ ๋ผ์ฐํ ์ ๊ตฌ์ฑํ๊ณ ๋ชจ๋ ๊ฒฝ๋ก๋ฅผ index.html ํ์ผ๋ก ์ง์ ํด์ผํฉ๋๋ค.
@lincenying @sorrycc์๊ฒ ๋ฌผ์ด๋ณด์ธ์
๊ทธ๋ ๋ค๋ฉด dva-cli๋ก ๋ง๋ ์ค์บ ํด๋์ด๊ณ dora๋ฅผ ๊ฐ๋ฐ ์๋ฒ๋ก ์ฌ์ฉํ๋ค๋ฉด ์ด๋ป๊ฒ ๊ตฌ์ฑํด์ผํ ๊น์?
๋ํ ์จ๋ผ์ธ ํ๊ฒฝ์ ์ ์์ ์ผ๋ก ๋ฐฐํฌํ๋ฉด (atools-build๋ก ์์ฑ๋จ) ์ด๋ป๊ฒํด์ผํฉ๋๊น?
@lincenying @sorrycc ์๊ฒ ๊ฐ์ฌ๋ฅผ ํํ๋ ํํ ๋ฆฌ์ผ์ด๋ ๋ฐ๋ชจ๊ฐ ์์ต๋๊น?
dora-plugin-browser-history ๋ฅผ ์ฌ์ฉํ๊ณ index ๋ฅผ
์๋ฒ (์ : ๋ ธ๋)์์ nginx ๋๋ ์ผ๊ด ์ฒ๋ฆฌ ๋ผ์ฐํ ์ ์ฌ์ฉํ์ฌ ์๋ฒ ์ง์์ด ํ์ํฉ๋๋ค. ์ : https://github.com/sorrycc/dva-boilerplate-isomorphic/blob/master/server/server.js#L22
๋งค๋ ฅ์ฒ๋ผ ์๋ํฉ๋๋ค โ๏ธ
@sorrycc
nginx์ ๊ฐ๋จํ ๊ตฌ์ฑ์ ์ถ๊ฐํฉ๋๋ค.
server {
listen 8088;
listen [::]:8088;
root /opt/web/static;
location / {
try_files $uri /index.html;
}
}
atool-build
์์ฑ
index.css
index.html
index.js
nginx ๋ฃจํธ ์๋์ ๋ฃ์ผ์ญ์์ค. /opt/web/static
location / {
try_files $uri /index.html;
}
ํ์ด์ง๋ฅผ ์๋ก ๊ณ ์น์ง ์์๋ ๋ฌธ์ ์์ต๋๋ค.๋ด๊ฐ ๋ง๋ ๋ฌธ์ ๋ dev.site/foo/bar
์ด์ด ํ์ด์ง
dev.site/foo/bar/common.js
...
dev.site/foo/bar/index.css
์ด ์ํฉ์์ nginx๋ฅผ ๊ตฌ์ฑํ๋ ๋ฐฉ๋ฒ์ ๋ชจ๋ฅด๊ฒ ์ต๋๋ค. ๊ฐ์ฌํฉ๋๋ค.
@xjdata ๋ฆฌ์์ค ํ์ผ์ ๋งํฌ๋ /common.js
์ ๊ฐ์ ์ ๋ ๊ฒฝ๋ก๋ฅผ ์ฌ์ฉํฉ๋๋ค.
@sorrycc ๊ฐ์ฌํฉ๋๋ค.
๋ก๋ ํธ๊ทธ ์๋ฒ ๊ฐ๋ฐ ํ๊ฒฝ์์ ๋ธ๋ผ์ฐ์ ํ์คํ ๋ฆฌ๋ฅผ ์ฌ์ฉํ๋ ๋ฐฉ๋ฒ
๋ํ roadhog ์๋ฒ ๊ฐ๋ฐ ํ๊ฒฝ์์ ๋ธ๋ผ์ฐ์ ํ์คํ ๋ฆฌ๋ฅผ ์ฌ์ฉํ๋ ๋ฐฉ๋ฒ์ ๋ํ ๋์์ ์์ฒญํ์ญ์์ค.
๊ฐ์ฅ ์ ์ฉํ ๋๊ธ
๋ก๋ ํธ๊ทธ ์๋ฒ ๊ฐ๋ฐ ํ๊ฒฝ์์ ๋ธ๋ผ์ฐ์ ํ์คํ ๋ฆฌ๋ฅผ ์ฌ์ฉํ๋ ๋ฐฉ๋ฒ