JuniorTour / vue-template-babel-compiler

Enable Optional Chaining(?.), Nullish Coalescing(??) and many new ES syntax for Vue.js SFC based on Babel
https://www.npmjs.com/package/vue-template-babel-compiler
118 stars 9 forks source link

[Question] Build Nuxt application in production mode #18

Closed eugen1j closed 2 years ago

eugen1j commented 3 years ago

I want to build my nuxt application without dev packages for production deployment.

My steps:

Detailed error ``` yarn run v1.22.10 $ nuxt build FATAL Cannot find module 'vue-template-babel-compiler' 11:49:44 Require stack: - /Users/macbook/WebstormProjects/vue-template-babel-compiler-nuxt-project/nuxt.config.js Require stack: - nuxt.config.js at Function.Module._resolveFilename (node:internal/modules/cjs/loader:941:15) at Function.resolve (node:internal/modules/cjs/helpers:99:19) at p (node_modules/jiti/dist/jiti.js:1:52987) at v (node_modules/jiti/dist/jiti.js:1:53886) at nuxt.config.js:6:19 at v (node_modules/jiti/dist/jiti.js:1:54801) at Object.loadNuxtConfig (node_modules/@nuxt/config/dist/config.js:1082:15) at loadNuxtConfig (node_modules/@nuxt/cli/dist/cli-index.js:338:32) at NuxtCommand.getNuxtConfig (node_modules/@nuxt/cli/dist/cli-index.js:463:26) at Object.run (node_modules/@nuxt/cli/dist/cli-build.js:90:30) ╭───────────────────────────────────────────────────────────────────────────────────────────────╮ │ │ │ ✖ Nuxt Fatal Error │ │ │ │ Error: Cannot find module 'vue-template-babel-compiler' │ │ Require stack: │ │ - /Users/macbook/WebstormProjects/vue-template-babel-compiler-nuxt-project/nuxt.config.js │ │ │ ╰───────────────────────────────────────────────────────────────────────────────────────────────╯ error Command failed with exit code 1. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command. ```

Should I install vue-template-babel-compiler as prod dependency instead? The documentation says that I should install the package as a dev dependency: npm install vue-template-babel-compiler --save-dev.

JuniorTour commented 3 years ago

@eugen1j You are right.

If you want this pkg to be installed by yarn install --prod , you need add it to dependencies of package.json by:

npm install vue-template-babel-compiler

without --save-dev.

You can ref this for detail:

JuniorTour commented 3 years ago

By the way, if you want to develop nuxt.js project in local env, There is no need to add --prod, use yarn install directly.