Open ryugonomura opened 5 years ago
Hmm, that's weird. Actually the test code contains such case (adding / removing page component during watch) and it passes. It may be some difference between webpack Node API and CLI. I'll look into it deeper later.
I am using "laravel-mix:^6.0.29"
/ "webpack": "^5.38.1"
and having the same issue.
vue-auto-routing
unless you kill the watch process and run it again.I think that the problem is kind of caching problem.
the file vue-auto-routing/index.js
is always correct but import routes from 'vue-auto-routing'
not always bring the latest copy of the routs.
Any Ideas to fix that?
For me I used the outFile
option and it does the job. I see some build errors momentarily but it's OK for me as it rebuilds after that with no errors.
This will force laravel-mix to reload the changes from the file because it's within the watch scope
module.exports = {
plugins: [
new VueAutoRoutingPlugin({
pages: 'src/pages',
importPrefix: '@/pages/',
outFile:'./resources/js/routes.js',
})
]
}
import autoRoutes from './routes';
const router = new Router({
...
routes: allRoutes,
...
})
the outFile
option needs to be added to the docs
Execute the "webpack --mode development --watch" command from the following URL. The following error occurs when deleting a newly created vuefile. https://github.com/rymizuki/example-vue-auto-routing
Also, when creating a vuefile while running "webpack --mode development --watch", a new route will not be written to the "./node_modules/vue-loader/lib/index.js" file.