bug: Module "xyz" has been externalized for browser compatibility
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.
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.
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?
Thank you for the hin. When run the build the warnings are gone but during development they are very annoying.
Do you get the same error if you uninstall daisyUI?
If yes, it's not related to daisyUI.
If I uninstall daisyUI, the error is gone
Can you share a reproduction repo?
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.
Feel free to re-open the issue after providing a reproduction repo.