Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

425
Views
Import/Export error: The requested module does not provide an export named 'pageFlip'

I recently switched over to the new Vite compiler for Laravel. I noticed that it somehow did not accept my window object anymore. No problem I thought, I'll just use imports/exports. However, I just keep getting the same error:

The requested module '../../../../../js/plugins/pageflip.js' does not provide an export named 'pageFlip'

I have searched all over the internet, but it keeps telling me not to confuse named exports/imports with default ones. However, I don't see anything wrong with my code. Could someone please help me with this?

show.blade.php

<div>
   HTML HERE
</div>

@push('scripts')
    <script type="module">
        import {pageFlip} from "../../../../../js/plugins/pageflip.js";

        @isset(condition here)
            pageFlip.turnToPage({{ $tale->taleUser->progress }})
        @endisset

        @can(condition here)
            pageFlip.on('flip', (e) => {
                document.getElementById('pageProgress').value = pageFlip.getCurrentPageIndex();
                document.getElementById('pageCount').innerHTML = pageFlip.getCurrentPageIndex();
            });
        @endcan

        function turnPage(bool) {
            if (bool) {
                return pageFlip.turnToNextPage();
            }

           return pageFlip.turnToPrevPage();
        }
    </script>
@endpush

My script file:

import {PageFlip} from 'page-flip'

const pageFlip = new PageFlip(document.getElementById('book'),
{
    width: 400,
    height: 600,
    size: ('stretch'),
    minWidth: 200,
    minHeight: 400,
    maxWidth: 1000,
    maxHeight: 1000,
    autoSize: true,
    disableFlipByClick: true,
    showCover: false
}
);

pageFlip.loadFromHTML(document.querySelectorAll('.tale-page'));

export { pageFlip }

The vite config file:

import { defineConfig } from 'vite';
import laravel from 'laravel-vite-plugin';

export default defineConfig({
plugins: [
    laravel([
        'resources/css/app.css',
        'resources/js/app.js',
        'resources/js/plugins/pageflip.js',
    ]),
],
});

Judging by the error, I am a bit confused. I really am providing an export named 'pageFlip', right? Or am I possibly missing some vite configuration?

I am using the StPageFlip package provided by Nodlik.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

p should be capital in PageFlip in show.blade.php file. So replace import {pageFlip} from "../../../../../js/plugins/pageflip.js"; with import {PageFlip} from "../../../../../js/plugins/pageflip.js";

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!