Replies: 2 comments 1 reply
-
Hey there. This can be very frustrating, but I figured it out. Here's my setup: First up, {
"scripts": {
"dev": "vite --config resources/js/vite.config.js",
"production": "vite build --config resources/js/vite.config.js"
}
}, Then within the import { defineConfig } from 'vite';
const { default : vue } = await import(`${process.cwd()}/node_modules/@vitejs/plugin-vue/dist/index.js`);
const { default : laravel } = await import(`${process.cwd()}/node_modules/laravel-vite-plugin/dist/index.js`);
let plugins = [
laravel.default([`${process.cwd()}/resources/js/app.js`]),
vue({ template: { transformAssetUrls: { base : null, includeAbsolute : false } } }),
];
let aliases = {
'@' : `${process.cwd()}/resources/vue`,
vue : `${process.cwd()}/node_modules/vue/dist/vue.esm-bundler.js`,
};
export default defineConfig({
plugins : plugins,
resolve : { alias : aliases },
}); It seems that when you're not in the root, you have to use import as a function and reference the current working directory. |
Beta Was this translation helpful? Give feedback.
1 reply
-
i'm a bit confused. in edit: ah, i see there are problems with this. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
hi,
i'm trying to config vite to be in a subdirectory.
the project looks like this:
the laravel project is in a subfolder, on the same level as public.
build works, but dev doesn't.
how should vite be config?
vite.config.js
:thanks for the help!
Beta Was this translation helpful? Give feedback.
All reactions