question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Uncaught SyntaxError: The requested module

See original GitHub issue

Versions:

  • @inertiajs/inertia version: 0.11.0
  • @inertiajs/inertia-svelte version: 0.8.0

Describe the problem:

when i using with laravel-vite , getting below error.

Uncaught SyntaxError: The requested module '/node_modules/@inertiajs/inertia/dist/index.js?v=8fdd45f8' does not provide an export named 'Inertia'

Steps to reproduce:

import { createInertiaApp } from '@inertiajs/inertia-svelte';
createInertiaApp({
    resolve: name => require(`./Pages/${name}.svelte`),
    setup({ el, App, props }) {
        new App({ target: el, props })
    }
});

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:3
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

5reactions
mbuckleycommented, Feb 21, 2022

@kvraamkey I ran into this same error when using vite-ruby with @inertiajs/inertia-svelte. I resolved things by importing Inertia in the main js entrypoint.


import { Inertia } from "@inertiajs/inertia"; // <== added this
import { createInertiaApp } from '@inertiajs/inertia-svelte'

createInertiaApp({
  resolve: name => require(`./Pages/${name}.svelte`),
  setup({ el, App, props }) {
    new App({ target: el, props })
  },
})
3reactions
ibnu-jacommented, Sep 25, 2022

use optimizeDeps.include to force @inertiajs/inertia & @inertiajs/inertia-svelte to be pre-bundled in vite

//vite.config.js
import { defineConfig } from 'vite';
import { svelte } from '@sveltejs/vite-plugin-svelte';
import laravel from 'laravel-vite-plugin';

export default defineConfig({
    plugins: [
        laravel([
            'resources/js/app.js',
        ]),
        svelte(),
    ],
    optimizeDeps: {
        include: [
            '@inertiajs/inertia',
            '@inertiajs/inertia-svelte',
        ]
    }
});
Read more comments on GitHub >

github_iconTop Results From Across the Web

42 - Stack Overflow
Uncaught SyntaxError: The requested module './add.js' does not provide an export named 'add' ; See the export default ? So it's a default...
Read more >
Requested module does not provide export named 'default'
The error "The requested module does not provide an export named 'default'" occurs when we try to import a value or a function...
Read more >
The requested module does not provide an export named
I have to fix this problem. Component.tsx:31 Uncaught SyntaxError: The requested module '/@fs/Users/user/Programming/react_project/node_modules/ ...
Read more >
the requested module 'fs' does not provide an export named 'fs ...
I'm getting an error stating my drawLine module isn't exporting something called default -why? The error it throws is: Uncaught SyntaxError: The requested...
Read more >
How to Solve does not provide an export named 'default'
For example, the SyntaxError occurs when we try to import a function or value from the file using ... SyntaxError: The requested module...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found