-
-
Notifications
You must be signed in to change notification settings - Fork 6.3k
Config source dir #1134
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
Comments
You can, just create a
|
@Pymous I agree with @ieshan, it would be nice just to set the |
It is possible, look at the snippet 😀 But I agree that it could be made more clear somewhere in the doc ! |
@Pymous I know it's possible using vue.config.js, I just think it should be made an option as other cli's like nuxt, poi etc... do 😄 |
@Pymous you also have to add these to your config https://github.com/vuejs/vue-cli/blob/dev/packages/%40vue/cli-plugin-eslint/index.js#L9 https://github.com/vuejs/vue-cli/blob/dev/packages/%40vue/cli-plugin-typescript/lib/tslint.js#L78 https://github.com/vuejs/vue-cli/blob/dev/packages/%40vue/cli-plugin-typescript/index.js#L23. So it's not just as simple as your snippet above. Making these use a variable and allowing you to just set sourceDir would be a nice addition IMO. |
There will not be a first-class option for this because we prefer all Vue CLI projects to have a consistent, standard directory structure. Using a different directory name is only a matter of personal taste, so if you insist on changing that, you are on your own. |
i had the same problem, i'm only using vue for front-end with zend expressive ( php ) on the back end, all modern php projects use the |
@yyx990803 I would like to kindly request that you reconsider your position. One of the core tenants of Vue CLI 3 is that you can go an incredibly long way without having to eject. Many people build Vue projects as subcomponents of other, larger projects. Usually these are servers of many different languages and frameworks; often at least partially responsible for serving the generated The This lack of configurability feels weird and inconsistent. |
@sam3d just spoke my mind, after going through several docs on the internet on how to rename src folder to client. |
I've started work on a package that attempts to emulate the desired native behaviour as closely as possible. $ vue add source-dir // vue.config.js
module.exports = {
pluginOptions: {
sourceDir: "client"
}
} https://github.com/sam3d/vue-source-dir This should be a first-class option though, and I would rather this was treated as a stopgap implementation as opposed to a long-term solution. |
Isn't that literally the entire point of being able to configure via As an example, you don't want an awkward |
@yyx990803 For one of the library I am developing I was using As a plugin developer for Vue, it makes sense for me to use vue-cli because it provides everything I need without the hassle of maintaining my package.json for serving, building, babel support, unit tests with babel support... |
Sorry to comment post-mortem but it seems relevant: Why does |
@cawoodm |
Can this please be changed already? Every modern PHP framework already uses the src directory. Making it close to impossible to use vue-cli without jumping trough 20 hoops. |
@ansien12 Did you try creating the vue project in a subfolder or a sibling folder? |
This needs to be added. |
I want to put vue in a client directory, this whole thing makes me so sad. I love vue, but jeez this stinks big. |
If you want to rename const path = require('path')
module.exports = {
configureWebpack: {
resolve: {
alias: {
'@': path.join(__dirname, 'client')
}
},
entry: {
app: path.join(__dirname, 'client', 'main.js')
}
}
} |
Like the others in this thread I really don't see why vue-cli shouldn't allow this, either. Having sensible defaults is nice, but not being able to configure it seems very unnecessary, and perhaps even a little out-of-character for Vue, being a less opinionated/coupled framework. Like @douglasg14b mentioned,
I hope you can reconsider this, Vue JS team :) |
@semonje
It's not "not being able to", it's just very inconvenient (as there were already workarounds posted in this thread) and if any gotchas encountered in that process it won't be our priority to fix these issues. |
@sodatea Sorry, let me rephrase, then :) Not being able to configure it in a not very inconvenient way seems very unnecessary. |
I spent the last 3 weeks trying to do project setup on this very issue because:
I implemented the fix and I'm still having issues with the Vuetify background.js file. This really feels very hackish and unprofessional both in design & solution. Please re-consider (I beg you on behalf of the community, on behalf of clean code, on behalf of all that is good/green/and right in the world) providing a slightly more formal customization with maybe a single paragraph in the documentation. (So total N00Bs like me don't have to spend a month or more trying to figure out how to get the customization they want, I was nearly ready to give up all-together on Vue over this issue! Since I am still facing issues, it is still concerning to me!!) I think this would go a long way to encouraging enterprise scale adoption of Vue & Vuey frameworks! When your users spend 3 years begging for a feature, might it be worth considering at least a slightly more formal solution? Just thinking about a professional reality check here, from one professional software developer to another. Thank you & Stay Safe!! :-D |
I should note that if you are building an Electron-Vue app then you will probably need to do this additional step....also not documented in any documentation file: https://nklayman.github.io/vue-cli-plugin-electron-builder/guide/configuration.html#webpack-configuration |
For the record I also still stumble upon this issue every now and then, and find it equally strange now as half a year ago. Like others have already requested, I think it'd make sense if the Vue JS team took another look at this. |
这个很好笑:vuejs/vue-cli#1134 (comment) 火了之后,这点小需求都不给满足。
"There will not be a first-class option for this because we prefer all Vue CLI projects to have a consistent, standard directory structure. Using a different directory name is only a matter of personal taste, so if you insist on changing that, you are on your own." This is so endemic of the arrogance of people in the tech industry. Yes, using a different directory name is only a matter of personal taste. And that's exactly where the prerogative should lie. You can prefer all Vue CLI projects to have a consistent, standard directory structure all you want. Forcing it on the developer is just rude and a slap to the face of people who have chosen Vue when they could have gone elsewhere. |
@jbnv You are the one being arrogant here.
It's never forced. It's just inconvenient to customize in Vue CLI and we won't provide first-class support for it. But it's customizable anyway.
You have no idea how much unnecessary burden these personal taste issues put on us.* And you are the one who tries to force someone else to do your favor for the sake of your personal taste. How dare you accuse us of arrogance? * Initial implementation of such a feature already costs time, to keep fixing all the edge cases is so much more energy-consuming. |
@jbnv : I honestly don't see how that translate to any arrogance from the Vue Dev Team... we have an amazing tool, let's not pick on each other for options and opinions. Maybe a middle ground can be found in the shape of a section in the doc ? To specify the tweaks needed to achieve the same result ? |
The configuration is something developers change/use. It should be related to the source code, not the tooling. The project tooling configuration should be separate to the application configuration. It's crazy that this config is in root. For others, we have done the following to fix this issue (in the scripts in package.json):
|
What problem does this feature solve?
There should be option in vue.config.js to change the 'src' dir to something else.
What does the proposed API look like?
module.exports = {
sourceDir: "client"
};
The text was updated successfully, but these errors were encountered: