Skip to content

feat: show error when --bundle option is not provided when executing some commands from {N} CLI #361

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 1 commit into from
Mar 18, 2019

Conversation

Fatme
Copy link

@Fatme Fatme commented Oct 18, 2018

Currently it is not possible to use vue template without bundle option. So we need to show an error in case when the user executes some command without bundle option.
This PR adds 2 hooks - before-checkForChanges and before-watch. Thеsе hooks will be triggered automatically by {N} CLI when the command is executed.

@tralves
Copy link

tralves commented Oct 18, 2018

Woah! I really like this idea!
It did seem like a lot of work to make it work. Isn't there a simpler way?

@@ -60,4 +61,27 @@ function write(dest, code) {
}
function logError(e) {
console.log(e)
}

function copyHooks() {
Copy link
Author

@Fatme Fatme Oct 18, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added this function in order to ensure the hooks directory will be copied to dist folder on build step. This way we'll ensure the hooks directory will be included in built package.
But I am not sure what is exactly the approach you use to pack/bundle the plugin's code.

We need this code only in case if we want to have all the code that will be bundled inside dist folder.
If you think this is unneeded, this function can be removed. If we decide to remove it, this line should be changed https://github.com/nativescript-vue/nativescript-vue/pull/361/files#diff-b9cfc7f2cdf78a7f4b91a753d10865a2R9 as well.

Let me know about your opinion on this matter.

@rigor789
Copy link
Member

rigor789 commented Nov 1, 2018

Woah! This is a nice idea, however I think solving this in the CLI would be a cleaner solution. See NativeScript/nativescript-cli#3873

That way the user can type both tns run android and tns run android --bundle and both will trigger a webpack build, which I think is a more desirable approach.

@VladimirAmiorkov
Copy link
Contributor

This needs to be merged as soon as possible. The current UX of an new user that comes to NativeScript + Vue and builds his application with the simples command tns run gets a very "incorrect" error leading to hours of struggling.

@rigor789 rigor789 merged commit 265f416 into nativescript-vue:master Mar 18, 2019
@jlooper
Copy link

jlooper commented Mar 18, 2019

It's a sweet merge BUT I believe it's breaking our new plugin: https://github.com/nativescript-vue/vue-cli-plugin-nativescript-vue - following the instructions to create and install the plugin, then running npm run serve:ios causes an error:

Unable to apply changes on device: emulator-5554. Error is: Nativescript-vue doesn't work without --bundle option. Please specify --bundle option to the command and execute it again..

which is strange because the npm script includes --bundle...

@doughensel
Copy link

I believe this feature may have broken my builds -- even trying the out-of-the-box template: vue init nativescript-vue/vue-cli-template test followed by tns run android --bundle I would get an error.

@Papabyte
Copy link

Papabyte commented Apr 4, 2019

I don't use webpack since it's not compatible with nativescript-nodeify, I use js files exporting templates instead of vue files and that worked well. With this change I cannot build anymore since I don't use --bundle on purpose.

@rigor789
Copy link
Member

rigor789 commented Apr 4, 2019

@Papabyte That's a valid point, which we didn't take into consideration... I think you can comment out the hooks as a temporary workaround, but definitely something we should fix. Would you mind opening an issue about this?

@Papabyte
Copy link

Papabyte commented Apr 4, 2019

@rigor789 thanks for your reply.
I created this issue: #469

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.

8 participants