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, //追加!