daisyui icon indicating copy to clipboard operation
daisyui copied to clipboard

bug: Module "xyz" has been externalized for browser compatibility

Open philharmonie opened this issue 2 years ago โ€ข 7 comments

What version of daisyUI are you using?

latest

Which browsers are you seeing the problem on?

Chrome

Reproduction URL

not available

Describe your issue

I installed daisyui with bun i --dev daisyui@latest into my project running "vite": "^4.0.0". In the browser logs I get:

 Module "source-map-js" has been externalized for browser compatibility. Cannot access "source-map-js.SourceMapConsumer" in client code. See http://vitejs.dev/guide/troubleshooting.html#module-externalized-for-browser-compatibility for more details.
Show lessModule "source-map-js" has been externalized for browser compatibility. Cannot access "source-map-js.SourceMapGenerator" in client code. See http://vitejs.dev/guide/troubleshooting.html#module-externalized-for-browser-compatibility for more details.
Show lessModule "path" has been externalized for browser compatibility. Cannot access "path.dirname" in client code. See http://vitejs.dev/guide/troubleshooting.html#module-externalized-for-browser-compatibility for more details.
Show lessModule "path" has been externalized for browser compatibility. Cannot access "path.relative" in client code. See http://vitejs.dev/guide/troubleshooting.html#module-externalized-for-browser-compatibility for more details.
Show lessModule "path" has been externalized for browser compatibility. Cannot access "path.resolve" in client code. See http://vitejs.dev/guide/troubleshooting.html#module-externalized-for-browser-compatibility for more details.
Show lessModule "path" has been externalized for browser compatibility. Cannot access "path.sep" in client code. See http://vitejs.dev/guide/troubleshooting.html#module-externalized-for-browser-compatibility for more details.
Show lessModule "url" has been externalized for browser compatibility. Cannot access "url.pathToFileURL" in client code. See http://vitejs.dev/guide/troubleshooting.html#module-externalized-for-browser-compatibility for more details.
Show lessModule "source-map-js" has been externalized for browser compatibility. Cannot access "source-map-js.SourceMapConsumer" in client code. See http://vitejs.dev/guide/troubleshooting.html#module-externalized-for-browser-compatibility for more details.
Show lessModule "source-map-js" has been externalized for browser compatibility. Cannot access "source-map-js.SourceMapGenerator" in client code. See http://vitejs.dev/guide/troubleshooting.html#module-externalized-for-browser-compatibility for more details.
Show lessModule "url" has been externalized for browser compatibility. Cannot access "url.fileURLToPath" in client code. See http://vitejs.dev/guide/troubleshooting.html#module-externalized-for-browser-compatibility for more details.
Show lessModule "url" has been externalized for browser compatibility. Cannot access "url.pathToFileURL" in client code. See http://vitejs.dev/guide/troubleshooting.html#module-externalized-for-browser-compatibility for more details.
Show lessModule "path" has been externalized for browser compatibility. Cannot access "path.isAbsolute" in client code. See http://vitejs.dev/guide/troubleshooting.html#module-externalized-for-browser-compatibility for more details.
Show lessModule "path" has been externalized for browser compatibility. Cannot access "path.resolve" in client code. See http://vitejs.dev/guide/troubleshooting.html#module-externalized-for-browser-compatibility for more details.
Show lessModule "source-map-js" has been externalized for browser compatibility. Cannot access "source-map-js.SourceMapConsumer" in client code. See http://vitejs.dev/guide/troubleshooting.html#module-externalized-for-browser-compatibility for more details.
Show lessModule "source-map-js" has been externalized for browser compatibility. Cannot access "source-map-js.SourceMapGenerator" in client code. See http://vitejs.dev/guide/troubleshooting.html#module-externalized-for-browser-compatibility for more details.
Show lessModule "fs" has been externalized for browser compatibility. Cannot access "fs.existsSync" in client code. See http://vitejs.dev/guide/troubleshooting.html#module-externalized-for-browser-compatibility for more details.
Show lessModule "fs" has been externalized for browser compatibility. Cannot access "fs.readFileSync" in client code. See http://vitejs.dev/guide/troubleshooting.html#module-externalized-for-browser-compatibility for more details.
Show lessModule "path" has been externalized for browser compatibility. Cannot access "path.dirname" in client code. See http://vitejs.dev/guide/troubleshooting.html#module-externalized-for-browser-compatibility for more details.
Show lessModule "path" has been externalized for browser compatibility. Cannot access "path.join" in client code. See http://vitejs.dev/guide/troubleshooting.html#module-externalized-for-browser-compatibility for more details.

philharmonie avatar Dec 13 '23 13:12 philharmonie

Thank you @philharmonie for reporting issues. It helps daisyUI a lot ๐Ÿ’š
I'll be working on issues one by one. I will help with this one as soon as a I find a solution.
In the meantime providing more details and reproduction links would be helpful.

github-actions[bot] avatar Dec 13 '23 13:12 github-actions[bot]

daisyUI is a dev dependency. It doesn't go to your bundle neither needs to loaded to the browser.
It only works at build time to add additional class names to Tailwind CSS.

Do you get the same error if you uninstall daisyUI?

saadeghi avatar Dec 13 '23 20:12 saadeghi

Thank you for the hin. When run the build the warnings are gone but during development they are very annoying.

philharmonie avatar Dec 14 '23 09:12 philharmonie

Do you get the same error if you uninstall daisyUI?

If yes, it's not related to daisyUI.

saadeghi avatar Dec 14 '23 11:12 saadeghi

If I uninstall daisyUI, the error is gone

philharmonie avatar Dec 14 '23 14:12 philharmonie

Can you share a reproduction repo?

saadeghi avatar Dec 15 '23 00:12 saadeghi

I am using a custom composable in vue:

import resolveConfig from 'tailwindcss/resolveConfig'
import tailwindConfig from '@/../../tailwind.config.js'

export function useColors() {
    const fullConfig = resolveConfig(tailwindConfig)

    const tailwindColors = fullConfig.theme.colors

    const extendedColors = {
        ...tailwindColors,
        ...tailwindConfig.theme.extend.colors,
    }

    return extendedColors
}

When I import this, I get the errors. When I don't import it, I don't get it.

philharmonie avatar Jan 02 '24 09:01 philharmonie

Feel free to re-open the issue after providing a reproduction repo.

saadeghi avatar Feb 12 '24 20:02 saadeghi