-
Notifications
You must be signed in to change notification settings - Fork 27.3k
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
Issue: svg-components with absolute imports not working #7117
Comments
Update:as for the tslinting part i ended up just adding an declare module '*.png'
declare module '*.jpg'
declare module '*.jpeg'
declare module '*.svg'
declare module '*.gif' |
I would like to work on this. @Timer , any advice on where I can start looking? |
This should be resolved, as i explained in my update it was just a declaration problem with typescript,
|
For anyone else landing here from Google at 1.30am in the morning whilst trying to deploy a prototype for a pitch, the following format in the declare module '*.png' I had to declare the properties as such: declare module "*.png" {
const value: any;
export default value;
} |
Not sure if it is related but I recently stumbled upon this while using Next.js absolute import with babel-plugin-inline-react-svg and expected I guess because it is Babel related, not Webpack related so absolute import won't work out of the box. Also this My solution is to create a |
Thank you! So far, this is the best solution |
If I use this I get the following error: |
fixed VSCode from complaining and works in runtime as expected
next-env.d.ts
next-config.js
|
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. |
Examples bug report
Example name
Describe the bug
Absolute Paths:Cannot find module 'svg/cat.svg.ts(2307)Cannot find module 'images/pexels-photo.jpg'.ts(2307)Relative Paths:Cannot find module '../assets/svg/cat.svg'.ts(2307)Cannot find module '../assets/images/pexels-photo.jpg'.ts(2307)( as i side note i added paths to my tsconfig )
To Reproduce
https://github.com/PaulPCIO/next.js-issues-svg-absolute-imports-tslint
uncomment lines in
components/ImageExamples.tsx
Expected behavior
Expect tslint to recognise image importationsScreenshots
#issue 1:
#issue 2:RESOLVEDSystem information
The text was updated successfully, but these errors were encountered: