Open austinhallock opened 2 years ago
Has this been resolved?
What's the update on this issue @austinhallock ?
The default example from the docs doesn't work either: https://nextjs.org/docs/app/api-reference/next-config-js/urlImports
Is this actually a bug or should it be a feature request?
My understanding of this feature suggests that this wasn't ever expected to work. But would be nice to hear from someone who knows. The docs are not super clear on what is actually happening in a number of the scenarios it goes over.
Just bumping this thread as I have run into the same dreaded issue. With this experiment enabled my css https:// imports fail 😢
Verify canary release
Provide environment information
What browser are you using? (if relevant)
No response
How are you deploying your application? (if relevant)
No response
Describe the Bug
Importing CSS from a URL doesn't appear to work if experimental.urlImports are enabled. This happens in both CSS (eg
@import url(https://...)
) and JS (egimport 'https://...'
)Potentially related to https://github.com/vercel/next.js/issues/30522
css-loader appears to have some newer code for Webpack's buildHttp which doesn't seem to be in the Next.js version of css-loader: https://github.com/webpack-contrib/css-loader/pull/1389/files
Expected Behavior
CSS imported from a URL w/o erroring
To Reproduce
1)
npx create-next-app
2) addexperimental: { urlImports: ['https://cdn.jsdelivr.net'] }
to next.config.js 3) add@import url('https://cdn.jsdelivr.net/npm/bootstrap@4.4.1/dist/css/bootstrap.min.css');
to top of globals.css 4) try loading siteShould give error:
Removing urlImports: [...] from next.config.js causes it to work again.
Same thing happens when trying to import via JS (eg
import 'https://cdn.jsdelivr.net/npm/bootstrap@4.4.1/dist/css/bootstrap.min.css'
)The error for importing from JS might be more helpful: