webpack-encore icon indicating copy to clipboard operation
webpack-encore copied to clipboard

Svelte loader Module not found

Open gponty opened this issue 1 year ago • 2 comments

Hi, Webpack 4.5

My webpack.config.js :

.addLoader({
                test: /\.svelte$/,
                loader: 'svelte-loader',
            },
            {
                // required to prevent errors from Svelte on Webpack 5+, omit on Webpack 4
                test: /node_modules\/svelte\/.*\.mjs$/,
                resolve: {
                    fullySpecified: false
                }
            }
        )
;

let config = Encore.getWebpackConfig();

config.resolve.mainFields = ['svelte', 'browser', 'module', 'main'];
config.resolve.extensions = ['.mjs', '.js', '.svelte'];
config.resolve.conditionNames = ['svelte', 'browser', 'import'];

let svelte = config.module.rules.pop();
config.module.rules.unshift(svelte);

module.exports = config;

When i import module (by example : import Select from 'svelte-select' ) i have this error :

Module build failed: Module not found:

"./node_modules/svelte-file-dropzone/dist/utils/index.js" contains a reference to the file "./attr-accept".
This file can not be found, please check it for typos or update it if the file got moved.

"./node_modules/svelte-floating-ui/index.js" contains a reference to the file "./core".
This file can not be found, please check it for typos or update it if the file got moved.

Then this files exists : image

Any idea ? Thank you

gponty avatar Jan 23 '24 15:01 gponty

Thank you for this issue. There has not been a lot of activity here for a while. Has this been resolved?

carsonbot avatar Sep 22 '24 12:09 carsonbot

Encore does not support Webpack 4 since a moment, do you still have the issue with latest Encore version?

Kocal avatar Feb 16 '25 16:02 Kocal

Hey, thanks for your report! There has not been a lot of activity here for a while. Is this bug still relevant? Have you managed to find a workaround?

carsonbot avatar Aug 17 '25 12:08 carsonbot

Could I get a reply or should I close this?

carsonbot avatar Aug 31 '25 12:08 carsonbot

Hey,

I didn't hear anything so I'm going to close it. Feel free to comment if this is still relevant, I can always reopen!

carsonbot avatar Sep 14 '25 12:09 carsonbot