soggypants
soggypants

Reputation: 425

Vite, Laravel and Vue.js - Error: Your current platform "undefined" and architecture "undefined"

Versions: Node v20.14.0 npm 10.7.0 Laravel v10.17.0

I use Vite, Vue.js and Laravel. When I run "npm run dev" and I open up the browser, I get the following Javascript error in browser's console:

Uncaught Error: Your current platform "undefined" and architecture "undefined" combination is not yet supported by the native Rollup build. Please use the WASM build "@rollup/wasm-node" instead.

I have tried adding

"overrides": {
    "rollup": "npm:@rollup/wasm-node"
}

to package.json and also

overrides: {
    "rollup": "npm:@rollup/wasm-node"
}

to vite.config.js. I still get the same error, nothing changed. After changing package.json I ran npm run i and re-run npm run dev.

When creating new Vite project with Vue,js (npm create vite@latest) without laravel vite plugin, everything works. But I need it to work with laravel-vite-plugin.

Why doesn't Rollup recognize my platform and architecture? Why can't I override Rollup to use platform-independent version?

Upvotes: 0

Views: 512

Answers (1)

soggypants
soggypants

Reputation: 425

I have found the solution.

In my app.js file instead of having

import { createApp } from 'vue';

I used

import { createApp } from 'vue/dist/vue.esm-bundler';

This post helped me: https://github.com/fengyuanchen/vue-feather/issues/8#issuecomment-787398213

Upvotes: -1

Related Questions