Skip to content

Conversation

@fyangstudio
Copy link
Contributor

@fyangstudio fyangstudio commented Feb 10, 2020

Update build directory rule as {web|weex}/{route.path}/index.{html|js}
Example:
app.json

{
  "routes": [
    {
      "path": "/",
      "source": "pages/Home/index"
    },
    {
      "path": "/page1",
      "source": "pages/Page1/index"
    }
  ]
}

SPA

Result:
*.chunk.js is webpack code splitting file,
rule: {route.source.replace('/', '').toLocaleLowerCase()}. chunk.js

build/
  web/
    index.html
    index.js
    pages_home_index.chunk.js
    pages_page1_index.chunk.js
  weex/
    index.js

If your app use the build directory as url, the url will be like:

path web weex
/ web/index.html weex/index.js
/page1 web/index.html#/page1 weex/index.js?_path=/page1

MPA

Result

build/
  web/
    index.html
    index.js
    path1/
      index.html
      index.js
  weex/
    index.js
    path1/
      index.js

If your app use the build directory as url, the url will be like:

path web weex
/ web/index.html weex/index.js
/page1 web/page1/index.html weex/path1/index.js

Preview
image

@fyangstudio fyangstudio changed the title Feat update MPA build path Feat update MPA build url path Feb 10, 2020
@yacheng
Copy link
Contributor

yacheng commented Feb 10, 2020

看到 npm run build 的结果是 web/pages_Home_index.html,并不是 path

@fyangstudio
Copy link
Contributor Author

看到 npm run build 的结果是 web/pages_Home_index.html,并不是 path

情况是 start 变成 path 了,build 没有吗?

yuanyan
yuanyan previously approved these changes Feb 10, 2020
chenjun1011
chenjun1011 previously approved these changes Feb 10, 2020
@chenjun1011
Copy link
Contributor

这个 PR 先别合,SSR 的 plugin 里,对 MPA 页面有写死 assets 加载路径,https://github.com/raxjs/rax-scripts/blob/master/packages/build-plugin-rax-ssr/src/ssr/getEntries.js#L38,升级后会不兼容,我看看怎么解

另外 def 的链路验证 OK 不?

@fyangstudio
Copy link
Contributor Author

fyangstudio commented Feb 11, 2020

这个 PR 先别合,SSR 的 plugin 里,对 MPA 页面有写死 assets 加载路径,https://github.com/raxjs/rax-scripts/blob/master/packages/build-plugin-rax-ssr/src/ssr/getEntries.js#L38,升级后会不兼容,我看看怎么解

另外 def 的链路验证 OK 不?

好的 另外 @yacheng

@chenjun1011 chenjun1011 mentioned this pull request Feb 12, 2020
@fyangstudio fyangstudio dismissed stale reviews from chenjun1011 and yuanyan via 6481dab February 12, 2020 12:41
@yacheng
Copy link
Contributor

yacheng commented Feb 17, 2020

本地测试验证通过

@fyangstudio fyangstudio merged commit 10727e6 into master Feb 19, 2020
@imsobear imsobear deleted the feat-update-mpa-url branch July 14, 2020 08:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants