Laravel npm运行监视不会在特定更改时重新加载

Laravel npm运行监视不会在特定更改时重新加载,laravel,vue.js,webpack,vuejs2,laravel-mix,Laravel,Vue.js,Webpack,Vuejs2,Laravel Mix,一旦我更改了某些内容,我想使用npm run watch来重建我的资产 这几乎适用于所有文件,但不适用于我添加到页面目录的文件。如果在页面-dir中更改后再次运行npm run watch,则正在处理更改 这是我的树: . ├── App.vue ├── components │   └── Cards │   └── Video.vue ├── entry-point.js ├── layouts │   └── Layout1.vue ├── main.js ├── pages │ 

一旦我更改了某些内容,我想使用
npm run watch
来重建我的资产

这几乎适用于所有文件,但不适用于我添加到
页面
目录的文件。如果在
页面
-dir中更改后再次运行
npm run watch
,则正在处理更改

这是我的树:

.
├── App.vue
├── components
│   └── Cards
│       └── Video.vue
├── entry-point.js
├── layouts
│   └── Layout1.vue
├── main.js
├── pages
│   └── Home
│       └── View.vue
├── router
│   ├── errors.js
│   ├── home.js
│   └── index.js
└── stores
这是
App.vue

<template>
    <router-view/>
</template>

<script>
    export default {
        name: 'app',
    }
</script>
这是
路由器/index.js

import Vue from 'vue'
import Router from 'vue-router'

import homeRoutes from './home'

Vue.use (Router);

const ROUTES = [
    // Default route
    {path: '', redirect: '/home'}
]
.concat (homeRoutes);

const router = new Router ({
    base: '/',
    mode: 'history',
    routes: ROUTES
});

export default router
import Layout1 from '@/js/layouts/Layout1'

export default [{
    path: '/home',
    component: Layout1,
    children: [{
        path: '/',
        component: () => import( /* webpackChunkName: "home-view" */ '@/js/Pages/Home/View'),
    }]
}]
const {EnvironmentPlugin} = require ('webpack');
const mix = require ('laravel-mix');
const glob = require ('glob');
const path = require ('path');
const {CleanWebpackPlugin} = require ('clean-webpack-plugin');
const ChunkRenamePlugin = require ('webpack-chunk-rename-plugin');

require ('laravel-mix-tailwind');
require ('laravel-mix-purgecss');


mix.webpackConfig ({
    output: {
        chunkFilename: 'js/chunks/[name].[chunkhash].js'
    },
    plugins: [
        new CleanWebpackPlugin ({
            cleanOnceBeforeBuildPatterns: ['chunks/**/*']
        }),
        new EnvironmentPlugin ({
            BASE_URL: '/'
        }),
        new ChunkRenamePlugin ({
            initialChunksWithEntry: true,
            '/js/app': 'js/entry-point.js',
            '/js/vendor': 'js/vendor.js',
        }),
    ],
    module: {
        rules: [
            {
                test: /node_modules(?:\/|\\).+\.js$/,
                loader: 'babel-loader',
                options: {
                    presets: [['@babel/preset-env', {targets: 'last 2 versions, ie >= 10'}]],
                    plugins: ['@babel/plugin-transform-destructuring', '@babel/plugin-proposal-object-rest-spread', '@babel/plugin-transform-template-literals'],
                    babelrc: false
                }
            },
        ]
    },
    resolve: {
        alias: {
            '@': path.join (__dirname, 'resources'),
            'node_modules': path.join (__dirname, 'node_modules')
        }
    },
});

mix.js ('resources/js/entry-point.js', 'public/js')
.postCss ('resources/css/app.css', 'public/css')
.tailwind ('./tailwind.config.js');


if (mix.inProduction ()) {
    mix
    .version ()
    .purgeCss ();
}

这是
路由器/home.js

import Vue from 'vue'
import Router from 'vue-router'

import homeRoutes from './home'

Vue.use (Router);

const ROUTES = [
    // Default route
    {path: '', redirect: '/home'}
]
.concat (homeRoutes);

const router = new Router ({
    base: '/',
    mode: 'history',
    routes: ROUTES
});

export default router
import Layout1 from '@/js/layouts/Layout1'

export default [{
    path: '/home',
    component: Layout1,
    children: [{
        path: '/',
        component: () => import( /* webpackChunkName: "home-view" */ '@/js/Pages/Home/View'),
    }]
}]
const {EnvironmentPlugin} = require ('webpack');
const mix = require ('laravel-mix');
const glob = require ('glob');
const path = require ('path');
const {CleanWebpackPlugin} = require ('clean-webpack-plugin');
const ChunkRenamePlugin = require ('webpack-chunk-rename-plugin');

require ('laravel-mix-tailwind');
require ('laravel-mix-purgecss');


mix.webpackConfig ({
    output: {
        chunkFilename: 'js/chunks/[name].[chunkhash].js'
    },
    plugins: [
        new CleanWebpackPlugin ({
            cleanOnceBeforeBuildPatterns: ['chunks/**/*']
        }),
        new EnvironmentPlugin ({
            BASE_URL: '/'
        }),
        new ChunkRenamePlugin ({
            initialChunksWithEntry: true,
            '/js/app': 'js/entry-point.js',
            '/js/vendor': 'js/vendor.js',
        }),
    ],
    module: {
        rules: [
            {
                test: /node_modules(?:\/|\\).+\.js$/,
                loader: 'babel-loader',
                options: {
                    presets: [['@babel/preset-env', {targets: 'last 2 versions, ie >= 10'}]],
                    plugins: ['@babel/plugin-transform-destructuring', '@babel/plugin-proposal-object-rest-spread', '@babel/plugin-transform-template-literals'],
                    babelrc: false
                }
            },
        ]
    },
    resolve: {
        alias: {
            '@': path.join (__dirname, 'resources'),
            'node_modules': path.join (__dirname, 'node_modules')
        }
    },
});

mix.js ('resources/js/entry-point.js', 'public/js')
.postCss ('resources/css/app.css', 'public/css')
.tailwind ('./tailwind.config.js');


if (mix.inProduction ()) {
    mix
    .version ()
    .purgeCss ();
}

现在我们得到了
webpack.mix.js

import Vue from 'vue'
import Router from 'vue-router'

import homeRoutes from './home'

Vue.use (Router);

const ROUTES = [
    // Default route
    {path: '', redirect: '/home'}
]
.concat (homeRoutes);

const router = new Router ({
    base: '/',
    mode: 'history',
    routes: ROUTES
});

export default router
import Layout1 from '@/js/layouts/Layout1'

export default [{
    path: '/home',
    component: Layout1,
    children: [{
        path: '/',
        component: () => import( /* webpackChunkName: "home-view" */ '@/js/Pages/Home/View'),
    }]
}]
const {EnvironmentPlugin} = require ('webpack');
const mix = require ('laravel-mix');
const glob = require ('glob');
const path = require ('path');
const {CleanWebpackPlugin} = require ('clean-webpack-plugin');
const ChunkRenamePlugin = require ('webpack-chunk-rename-plugin');

require ('laravel-mix-tailwind');
require ('laravel-mix-purgecss');


mix.webpackConfig ({
    output: {
        chunkFilename: 'js/chunks/[name].[chunkhash].js'
    },
    plugins: [
        new CleanWebpackPlugin ({
            cleanOnceBeforeBuildPatterns: ['chunks/**/*']
        }),
        new EnvironmentPlugin ({
            BASE_URL: '/'
        }),
        new ChunkRenamePlugin ({
            initialChunksWithEntry: true,
            '/js/app': 'js/entry-point.js',
            '/js/vendor': 'js/vendor.js',
        }),
    ],
    module: {
        rules: [
            {
                test: /node_modules(?:\/|\\).+\.js$/,
                loader: 'babel-loader',
                options: {
                    presets: [['@babel/preset-env', {targets: 'last 2 versions, ie >= 10'}]],
                    plugins: ['@babel/plugin-transform-destructuring', '@babel/plugin-proposal-object-rest-spread', '@babel/plugin-transform-template-literals'],
                    babelrc: false
                }
            },
        ]
    },
    resolve: {
        alias: {
            '@': path.join (__dirname, 'resources'),
            'node_modules': path.join (__dirname, 'node_modules')
        }
    },
});

mix.js ('resources/js/entry-point.js', 'public/js')
.postCss ('resources/css/app.css', 'public/css')
.tailwind ('./tailwind.config.js');


if (mix.inProduction ()) {
    mix
    .version ()
    .purgeCss ();
}


我假设发生这种情况是因为我的
webpack.mix.js中缺少配置,但我无法解决这个问题。

解决方案很简单:
页面
目录在文件结构中是小写的,但在路由器的定义中是大写的。

您的
页面
目录的路径是什么?