Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When I try to import @inertiajs/vue, I get error "Uncaught SyntaxError: The requested module '/node_modules/deepmerge/dist/cjs.js?v=51e75926' does not provide an export named 'default'" #1814

Closed
tkoop opened this issue Feb 29, 2024 · 2 comments

Comments

@tkoop
Copy link

tkoop commented Feb 29, 2024

Version:

  • @inertiajs/vue3 version: 1.0.15

Describe the problem:

In my main.js page, I have this line:
import { createInertiaApp } from '/node_modules/@inertiajs/vue3'

But when it runs in a browser, the browser says:
Uncaught SyntaxError: The requested module '/node_modules/deepmerge/dist/cjs.js?v=51e75926' does not provide an export named 'default'

Steps to reproduce:

Install Laravel and Vite and Inertia.

In index.blade.php:
@Vite('/resources/views/pages/main.js')

In that main.js file:
import { createApp, h } from '/node_modules/vue'
import { createInertiaApp } from '/node_modules/@inertiajs/vue3'

The "vue" file gets imported, but I can't import @inertiajs/vue3, becaues the browser throws that error.

I am not including deepmerge in my package.json, but package-lock.json mentions node_modules/deepmerge version 4.3.1

@craigrileyuk
Copy link
Contributor

Why are you trying to import using the absolute path anyway?

NodeJS automatically resolves imports based on the package name using the best available location. You're probably breaking the logic by trying to force it to use a specific location.

What's wrong with:

import { createApp, h } from 'vue'
import { createInertiaApp } from '@inertiajs/vue3'

as used in every single project in existence?

@reinink
Copy link
Member

reinink commented May 28, 2024

Closing this one because we haven't heard anything back.

@reinink reinink closed this as completed May 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants