Eonasdan / tempus-dominus

A powerful Date/time picker widget.
https://getdatepicker.com
MIT License
7.16k stars 4.41k forks source link

Module parse failed when using Encore/Webpack #2880

Closed numediaweb closed 6 months ago

numediaweb commented 7 months ago

Prerequisites

Describe the issue

Hi everyone,

I included this library in my project:

yarn add @popperjs/core @eonasdan/tempus-dominus

Then required it:

import { TempusDominus } from '@eonasdan/tempus-dominus';

But I get this error when running the yarn watch command

 ERROR  Failed to compile with 1 errors                                                                                                     3:03:53 PM

 error  in ./node_modules/@eonasdan/tempus-dominus/dist/js/tempus-dominus.esm.js

Module parse failed: Unexpected token (925:49)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
|         })
|             .formatToParts(this)
>             .find((p) => p.type === 'dayPeriod')?.value;
|     }
|     /**

Any help is appreciated :)

StackBlitz fork

// no code to give

What operating system(s) are you seeing the problem on?

macOS

What browser(s) are you seeing the problem on?

Chrome

What version of are you using? You can find this information from the sample StackBlitz.

v6

What your browser's locale? You can find this information from the sample StackBlitz.

en-US