Akryum / Akryum/vue-cli-plugin-ssr

Fatal issue with deps ordering in package.json

Đang mở
#209 1 bình luận 1 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
JavaScript
Star
441
Fork
69
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

Hi @Akryum ,

I'm using your plugin since a long time and decided to upgrade to fix lot of workarounds I put on. I'm now on the `v0.6.0` but each time I try to reach a page I get:
```
App running at:
- Local: http://localhost:8000/ (copied to clipboard)
[21:02:04] Server listening on localhost:8000
error during render url : /
Error: bundle export should be a function when using { runInNewContext: false }.
at /Users/XXXXXXXXX/Documents/tests/aaa/node_modules/vue-server-renderer/build.dev.js:9381:17
at new Promise ()
at /Users/XXXXXXXXX/Documents/tests/aaa/node_modules/vue-server-renderer/build.dev.js:9368:14
at Object.renderToString (/Users/XXXXXXXXX/Documents/tests/aaa/node_modules/vue-server-renderer/build.dev.js:9544:9)
at renderApp (/Users/XXXXXXXXX/Documents/tests/aaa/node_modules/@akryum/vue-cli-plugin-ssr/lib/app.js:123:16)
at /Users/XXXXXXXXX/Documents/tests/aaa/node_modules/@akryum/vue-cli-plugin-ssr/lib/app.js:172:33
```

After spending a while on this error I succeeded making working. For this I need to put in the `package.json` your plugin below the `@vue/cli-plugin-typescript` like this:
```
...
"@vue/cli-plugin-typescript": "~4.4.0",
"@akryum/vue-cli-plugin-ssr": "~0.6.0",
...
```

In case I put yours at the top of its object (due to alphabetical ordering done automatically), this simply breaks 😭

I always thought the `package.json` ordering was not mattering. But it seems it does 🤔

If you have any idea, I would really appreciate 👍

Thank you,

**EDIT:** note that I also tried with a project from scratch by doing
```
vue create aaa
vue add router
vue add @akryum/ssr
```
if I test it works!
But then if I add:
```
vue add typescript
```
Then it breaks as described, except if I manually switch the deps order in `package.json` 😞

**EDIT2:** since for each `yarn install/upgrade...` it will break the "workaround", I decided to move your plugin in the "dependencies" object as follow:
```
{
...
"dependencies": {
"@akryum/vue-cli-plugin-ssr": "~0.6.0",
...
},
"devDependencies": {
...
"@vue/cli-plugin-e2e-nightwatch": "~4.4.0",
"@vue/cli-plugin-pwa": "~4.4.0",
"@vue/cli-plugin-router": "~4.4.0",
"@vue/cli-plugin-typescript": "~4.4.0",
"@vue/cli-plugin-unit-jest": "~4.4.0",
...
},
}
```
in this case the auto-sorting won't break the workaround.

It's for sure not a long-term solution, I really hope someone has some insights about this 👍

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.