-
Notifications
You must be signed in to change notification settings - Fork 27k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
<image/> tag error in version 11.0.0 #26196
Comments
Same as: #25950 Can you disable the new static image feature for now:
|
@gustavpursche that works as a workaround for now :) |
I have the same problem when using with
It works after removing it since now we can directly import the image outside of the public folder in NextJS v11. |
@timneutkens here's my repro: next.config.jsconst path = require('path')
const { createLoader } = require('simple-functional-loader')
const visit = require('unist-util-visit')
const withBundleAnalyzer = require('@next/bundle-analyzer')({
enabled: process.env.ANALYZE === 'true',
})
const rehypeHighlightCode = require('./rehype/highlight-code')
const rehypeMetaAttribute = require('./rehype/meta-attribute')
// const { withSyntaxHighlighting } = require('./remark/withSyntaxHighlighting')
// const withCodeSamples = require('./remark/withCodeSamples')
module.exports = withBundleAnalyzer({
pageExtensions: ['js', 'jsx', 'ts', 'tsx', 'md', 'mdx'],
experimental: {
modern: true,
},
images: {
disableStaticImages: true,
},
redirects: async () => {
return require('./redirects.json')
},
webpack: (config, options) => {
config.module.rules.push({
test: /\.(svg|png|jpe?g|gif|mp4)$/i,
use: [
{
loader: 'file-loader',
options: {
publicPath: '/_next',
name: 'static/media/[name].[hash].[ext]',
},
},
],
})
const mdx = [
options.defaultLoaders.babel,
{
loader: '@mdx-js/loader',
options: {
remarkPlugins: [
/*withCodeSamples, withSyntaxHighlighting*/
],
rehypePlugins: [rehypeMetaAttribute, rehypeHighlightCode],
},
},
]
config.module.rules.push({
test: /\.mdx$/,
oneOf: [
{
resourceQuery: /preview/,
use: [
...mdx,
createLoader(function (src) {
if (src.includes('<!-- more -->')) {
const [preview] = src.split('<!-- more -->')
return this.callback(null, preview)
}
const [preview] = src.split('<!--/excerpt-->')
return this.callback(null, preview.replace('<!--excerpt-->', ''))
}),
],
},
{
resourceQuery: /rss/,
use: [
...mdx,
createLoader(function (src) {
return this.callback(null, src)
}),
],
},
{
include: [path.resolve(__dirname, 'src/pages/essay')],
use: [
...mdx,
createLoader(function (src) {
const content = [
'import Essay from "@/components/Essay"',
'export { getStaticProps } from "@/utils/essay/getStaticProps"',
src,
'export default (props) => <Essay meta={meta} {...props} />',
].join('\n')
if (content.includes('<!-- more -->')) {
return this.callback(null, content.split('<!-- more -->').join('\n'))
}
return this.callback(null, content.replace(/<!--excerpt-->.*<!--\/excerpt-->/s, ''))
}),
],
},
{
include: [path.resolve(__dirname, 'src/pages/tutorial')],
use: [
...mdx,
createLoader(function (src) {
const content = [
'import Tutorial from "@/components/Tutorial"',
'export { getStaticProps } from "@/utils/tutorial/getStaticProps"',
src,
'export default (props) => <Tutorial meta={meta} {...props} />',
].join('\n')
if (content.includes('<!-- more -->')) {
return this.callback(null, content.split('<!-- more -->').join('\n'))
}
return this.callback(null, content.replace(/<!--excerpt-->.*<!--\/excerpt-->/s, ''))
}),
],
},
],
})
if (!options.dev && options.isServer) {
const originalEntry = config.entry
config.entry = async () => {
const entries = { ...(await originalEntry()) }
entries['./scripts/build-rss'] = './scripts/build-rss.js'
entries['./scripts/build-sitemap'] = './scripts/build-sitemap.js'
return entries
}
}
return config
},
}) And the repo is at → https://github.com/deadcoder0904/better-code-blocks (just update Next.js to Before updating to |
Thanks for reporting this issue! This looks like a duplicate of #26130 so we're going to consolidate to one issue. |
This PR does a couple things: 1. Omit svg static imports if the user has defined custom webpack config with svg rule 2. Change TS type to `any` for svg imports to avoid conflicts with other plugins The idea is that some users want to use `next/image` with static imports for most image types but not for svg and instead inline those images with a plugin. - Fixes #25950 - Fixes #26130 - Fixes #26176 - Fixes #26196 - Fixes #26067 ## Bug - [x] Related issues linked using Fixes #26130 - [x] Integration tests added
…6281) This PR does a couple things: 1. Omit svg static imports if the user has defined custom webpack config with svg rule 2. Change TS type to `any` for svg imports to avoid conflicts with other plugins The idea is that some users want to use `next/image` with static imports for most image types but not for svg and instead inline those images with a plugin. - Fixes vercel#25950 - Fixes vercel#26130 - Fixes vercel#26176 - Fixes vercel#26196 - Fixes vercel#26067 ## Bug - [x] Related issues linked using Fixes vercel#26130 - [x] Integration tests added
@styfle do I still need to add this workaround even if I install Because without it, I still get the error:
|
@deadcoder0904 They released version 11.0.1 which fixes the issues. |
@maximegheraille i tried it but didn't work before. i tried again after cleaning cache & it works now. no need to add the existing workaround. thank you :) |
Update code from
to
|
I have latest next version and it's still broken. |
This issue has been automatically locked due to no recent activity. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you. |
What version of Next.js are you using?
11.0.0
What version of Node.js are you using?
v14.15.3
What browser are you using?
chrome
What operating system are you using?
Windows
How are you deploying your application?
none
Describe the Bug
Hi,
I am getting a problem with an tag when upgrading from 10.2.3 to 11.0.0 while changing nothing in my code.
error on the image src
error from the console
my simple image tag
Expected Behavior
I expected to have no problem when upgrading to 11.0.0
To Reproduce
use an
<img/>
tag with a local image with version 10.2.3 and upgrade to version 11.0.0The text was updated successfully, but these errors were encountered: