LoginSignup
5
4

More than 3 years have passed since last update.

nuxt dockerで使う個人的な設定

Last updated at Posted at 2020-01-25

Docker

npm install -g create-nuxt-app
npx create-nuxt-app プロジェクト名

ポート変更

package.json

{
  "name": "vue",
  "version": "0.1.0",
  "private": true,
  "scripts": {
+    "dev": "PORT=8080 nuxt",
    ....
  },

nuxt-config.js

module.exports = {
  server: {
+    port: 8080, // デフォルト: 3000
+    host: '0.0.0.0' // デフォルト: localhost
  },

ホットリロード

nuxt-config.js

module.exports = {
  ...
+  watchers: {
+    webpack: {
+        poll: true
+    }
  }

SPAモード

nuxt-config.js

module.exports = {
+  mode: 'spa',

レイアウトの変更

xxx.vue内
使用するレイアウトは layouts/testlo.vue

export default {
+  layout: 'testlo',
  components: {
    AppLogo
  }
}

その他

Nuxt FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory

nuxt.config.js

  build: {
+    standalone: true, //追加!
5
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
4