When nuxt.js is running in production, it doesn't need webpack. However, because it's listed as dependency it will always be installed.
If an npm module were made (I propose nuxt-dev) which contains these dependencies, a user of Nuxt would be able to add that module to their devDependencies list. The resulting package.json for a Nuxt project would look like this:
{
"name": "my-app",
"dependencies": {
"nuxt": "latest"
},
"devDependencies": {
"nuxt-dev": "latest"
},
"scripts": {
"dev": "nuxt",
"build": "nuxt build",
"start": "nuxt start"
}
}
The nuxt-dev package could contain everything needed "build" the application, while the nuxt package would contain the "runtime" dependencies and any runtime-level code.
+1,
You would have to build projects locally and upload .nuxt to the production server with other files.
On the other hand, the production server would be much cleaner without linters and webpack.
The only drawback is the additional complexity.
I personally think that it should not be done, replacing the nuxt module as you proposed with the addition of nuxt-dev.
You would have to make nuxt module cleaner and people who got used to what to expect will be frustrated.
Alternatively, we could create a clean production module. Thus, it would be just an addition for developers to further improve their production state.
Then, it's the same thing, upload it to the server prebuilt locally, and use another package.json for the clean production module.
What about something like nuxt-serve for serving the .nuxt/dist/ folder in production, and nuxt start will simply use nuxt-serve (as a peerDependencie)?
So the package.json will look like this for someone who want to optimize the npm install in production:
{
"name": "my-app",
"dependencies": {
"nuxt-serve": "latest"
},
"devDependencies": {
"nuxt": "latest"
},
"scripts": {
"dev": "nuxt",
"build": "nuxt build",
"start": "nuxt-serve"
}
}
And this scenario will still work:
{
"name": "my-app",
"dependencies": {
"nuxt": "latest"
},
"scripts": {
"dev": "nuxt",
"build": "nuxt build",
"start": "nuxt start"
}
}
Or maybe calling the package nuxt-start? :smile:
@Atinux,
I'd suggest to name that nuxt-prod because it's hard to understand what start and serve mean
You know best how to clean the nuxt-serve(or any other name) as much as possible, but if you want to decrease your workload, I could try to clean it first
I like @Atinux's suggestion, but I agree it should probably be named something like nuxt-prod, nuxt-runtime, or maybe nuxt-prebuilt?
馃槻馃槀 I thought I proposed the idea of making the production module, instead of modifications, first
Please consider using nuxt-start 馃槃
Thanks for this idea guys!
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Most helpful comment
What about something like
nuxt-servefor serving the.nuxt/dist/folder in production, andnuxt startwill simply usenuxt-serve(as a peerDependencie)?So the package.json will look like this for someone who want to optimize the
npm installin production:And this scenario will still work:
Or maybe calling the package
nuxt-start? :smile: