flowbite-svelte
flowbite-svelte copied to clipboard
Can't find types
Describe the bug
I'm running a website with Symfony has backend, it has working Flowbite and Tailwind with DaisyUI and Svelte. It's set up via Webpack Encore. I've followed most of the relevant setup and it almost works, only when I run npm run watch
I get this error
Module build failed: Module not found:
"./node_modules/flowbite-svelte/dist/index.js" contains a reference to the file "./types".
This file can not be found, please check it for typos or update it if the file got moved.
I'ts about this line:
// types
export * from './types';
When I'm in my editor I can click on the line and the types.d.ts
file loads. When I comment out the line webpack encore compiles it perfectly fine, and everything works as I expect it to.
Did I miss something obvious? Is this something that should be ignored or something?
Flowbite version and System Info
System:
OS: Linux 5.15 Ubuntu 22.04.4 LTS 22.04.4 LTS (Jammy Jellyfish)
CPU: (12) x64 12th Gen Intel(R) Core(TM) i7-1265U
Memory: 2.46 GB / 5.79 GB
Container: Yes
Shell: 5.1.16 - /bin/bash
Binaries:
Node: 21.6.1 - ~/.nvm/versions/node/v21.6.1/bin/node
Yarn: 1.22.5 - /usr/bin/yarn
npm: 10.2.4 - ~/.nvm/versions/node/v21.6.1/bin/npm
npmPackages:
flowbite-svelte: ^0.44.23 => 0.44.23
svelte: ^3.0 || ^4.0 => 4.2.11
webpack: ^5.74.0 => 5.90.1
I noticed that when I remove config.resolve.conditionNames = ['svelte', 'browser', 'import'];
from my webpack config that I get another error.
Module not found: Error: Package path . is not exported from package /path_here/node_modules/flowbite-svelte (see exports field in /path_here/node_modules/flowbite-svelte/package.json)
But I had that line in my config because otherwise I get WARNING: You should add "svelte" to the "resolve.conditionNames" array in your webpack config. See https://github.com/sveltejs/svelte-loader#resolveconditionnames for more information
. So it's really confusing all...
What is the details of npm run watch
?
Can you try npm run dev
?
npm run watch
is the same as npm run dev
but with --watch
added. Sadly the same output for npm run dev
.
Managed to fix it, thanks for the help.
Managed to fix it, thanks for the help.
How? Could you please explain?
Managed to fix it, thanks for the help.
How? Could you please explain?
I fixed this issue by adding this to my webpack config:
module.exports = {
// ... rest of config
module: {
rules: [
// ... other rules
{
test: /node_modules\/flowbite-svelte\/.*\.js$/,
resolve: {
fullySpecified: false,
},
},
],
}
}