6eDesign / svelte-calendar

A lightweight datepicker with neat animations and a unique UX.
https://6edesign.github.io/svelte-calendar/
MIT License
543 stars 90 forks source link

Use .js extension #168

Open tipy01 opened 1 year ago

tipy01 commented 1 year ago

I had got these errors on building my app importing svelte-calendar:


ERROR in ./node_modules/svelte-calendar/directives/scrollable.js 1:0-46
Module not found: Error: Can't resolve '../config/scroll' in '/myproject/node_modules/svelte-calendar/directives'
Did you mean 'scroll.js'?
BREAKING CHANGE: The request '../config/scroll' failed to resolve only because it was resolved as fully specified
(probably because the origin is strict EcmaScript Module, e. g. a module with javascript mimetype, a '*.mjs' file, or a '*.js' file where the package.json contains '"type": "module"').
The extension in the request is mandatory for it to be fully specified.
Add the extension to the request.

ERROR in ./node_modules/svelte-calendar/index.js 11:0-49
Module not found: Error: Can't resolve './directives/scrollable' in '/myproject/node_modules/svelte-calendar'
Did you mean 'scrollable.js'?
BREAKING CHANGE: The request './directives/scrollable' failed to resolve only because it was resolved as fully specified
(probably because the origin is strict EcmaScript Module, e. g. a module with javascript mimetype, a '*.mjs' file, or a '*.js' file where the package.json contains '"type": "module"').
The extension in the request is mandatory for it to be fully specified.
Add the extension to the request.

ERROR in ./node_modules/svelte-calendar/index.js 13:0-41
Module not found: Error: Can't resolve './config/theme' in '/myproject/node_modules/svelte-calendar'
Did you mean 'theme.js'?
BREAKING CHANGE: The request './config/theme' failed to resolve only because it was resolved as fully specified
(probably because the origin is strict EcmaScript Module, e. g. a module with javascript mimetype, a '*.mjs' file, or a '*.js' file where the package.json contains '"type": "module"').
The extension in the request is mandatory for it to be fully specified.
Add the extension to the request.

I can manage to get rid of that specifying the following in my module rules in webpack.config.js :

                {
                    test: function test(modulePath) {
                        return modulePath.includes('svelte-calendar');
                    },
                    resolve: {
                        fullySpecified: false,
                    },
                }

But it will be smarter if these 3 imported modules have .js extension, like it is expected when package.json includes "type":"module" .