Akryum / Akryum/vue-cli-plugin-ssr

Fatal issue with deps ordering in package.json

Aperta
#209 1 commento 1 reazione 0 assegnatari Vedi su GitHub
Lingua principale
JavaScript
Stelle
441
Fork
69
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

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 👍

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.