Encountering a 404 error when using quasar+vite in vueRouterMode: 'history'
mode with paths containing a period/dot in the id? This issue has been discussed in various places:
- https://github.com/vitejs/vite/issues/2415
- https://github.com/vitejs/vite/issues/4344
- Handling dot in vue-router params using vue 3
Many recommend using vite-plugin-rewrite-all, but implementing it may not be straightforward. The suggested usage is as follows:
// vite.config.js
import pluginRewriteAll from 'vite-plugin-rewrite-all';
export default {
plugins: [pluginRewriteAll()]
}
Referencing the documentation doesn't seem to resolve the problem. Importing or requiring the ES Module in quasar.config.js leads to errors like:
# Using:
# import pluginRewriteAll from 'vite-plugin-rewrite-all'
SyntaxError: Cannot use import statement outside a module
# Using:
# const pluginRewriteAll = require('vite-plugin-rewrite-all')
Error [ERR_REQUIRE_ESM]: require() of ES Module ./node_modules/vite-plugin-rewrite-all/dist/index.mjs not supported.
Instead change the require of ./node_modules/vite-plugin-rewrite-all/dist/index.mjs to a dynamic import() which is available in all CommonJS modules. code: 'ERR_REQUIRE_ESM'
Seeking assistance from anyone familiar with resolving this issue!