Skip to content

Update template path for router.js #35

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 7, 2020

Conversation

phdd
Copy link
Contributor

@phdd phdd commented Jan 3, 2020

Fix for #34

invoking generator for vue-cli-plugin-nativescript-vue... ERROR Error: Cannot find module '@vue/cli-service/generator/router/template/src/router.js' from '/Users/user/Projects/my-app/node_modules/vue-cli-plugin-nativescript-vue/generator/templates/simple/src'

@jawa-the-hutt jawa-the-hutt merged commit c0d6750 into nativescript-vue:master Jan 7, 2020
@phdd phdd deleted the patch-1 branch January 16, 2020 08:23
@rigor789
Copy link
Member

Looks like this change has broken the router generation, the generated file (src/router.ts) contains the following:

module.exports = (api, options) => {
  require('@vue/cli-plugin-router/generator')(api, {
    historyMode: options.routerHistoryMode,
  };
  export default new Router(options);
};

This is definitely not the desired result. A router/index.ts file is also generated, which looks correct for the most part, but the import { options } from './router' in main.native.ts no longer works.

After manually refactoring router/index to export the routes, and updating the routes.reduce function in main.native the app builds, but seems like the default route names have changed from lowercase to titlecase so goTo('home') and goTo('about') no longer work unless we either change the route names, or update the goTo calls to use the correct casing (home -> Home, about -> About).

@Darshan4450
Copy link

can you please tell me what should i update in router/index.js file and in routes.reduce function ??

@aspickard
Copy link

I would also love to know how to fix this error.

@rigor789
Copy link
Member

rigor789 commented Jun 7, 2020

@Darshan197 @aspickard I don't have my changes anymore, but I will re-check and share what I've done... Just been a few really busy weeks.

@aspickard
Copy link

Thanks so much I'm just starting nativescript and it's been a pretty bumpy start haha. I got through a few other setup errors but this one was the last straw :p

@aspickard
Copy link

aspickard commented Jun 8, 2020

So if anyone needs a work around you can check this out:

https://github.com/nativescript-vue/vue-cli-plugin-nativescript-vue/compare/master...aspickard:master?diff=split

Obviously it's just doing a file replace of the router.js, but personally I think that's better than monkeypatching with the regex like it was done before 🤷

Also if you are using the nvw template you will have to apply the stylesheet fixes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

5 participants