Skip to content

Use .js extension #168

@tipy01

Description

@tipy01

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" .

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions