Closed robbiecren07 closed 3 years ago
Hey @robbiecren07!
The warning you get in the first screenshot is regarding typescript. I have not added type information to this package.
Regarding the other problem, you should not see converted images when running development mode. The webpack-dev-server
keeps the assets in memory so you'll not find them on disk. Did you try running the production build?
Hi,
Just implemented this plugin on my Typescript repo. This plugin is not written with Typescript so you do not have types.
You can avoid this error by following this steps :
@types
folder.@types
folder.Here is my configuration :
// tsconfig.json
{
"ts-node": {
"compilerOptions": {
"module": "commonjs"
}
},
"compilerOptions": {
"baseUrl": "./",
"sourceMap": true,
"module": "esnext",
"target": "es2017",
"moduleResolution": "node",
"jsx": "react",
"checkJs": false,
"allowJs": false,
"importHelpers": true,
"noImplicitAny": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"esModuleInterop": true,
"experimentalDecorators": true,
"resolveJsonModule": true,
"allowSyntheticDefaultImports": true,
"typeRoots": ["./node_modules/@types", "./src/@types", "./config/@types"], // note this line
"paths": {
"@/*": ["./src/*"]
}
},
"exclude": [
"build",
"stats",
"reports",
"coverage",
"server",
".vscode",
".github",
"**/node_modules/**",
"config/test/**"
]
}
// declaration file, under your @types folder specified in your tsconfig.json
declare module 'imagemin-webp-webpack-plugin' {
export interface IConfig {
test: RegExp
options: {
quality: number
}
}
export interface IOptions {
config: IConfig[]
overrideExtension: boolean
detailedLogs: boolean
silent: boolean
strict: boolean
}
class ImageminWebpWebpackPlugin {
constructor(options: IOptions)
}
export default ImageminWebpWebpackPlugin
}
Closing this one, seems to be resolved
I have installed and setup the plugin as per the instructions in the README. Here is a screenshot of the message im getting:
My test image in my index.html file looks like:
<img alt="" src="images/9ine-gaming.webp" />
The actual image in my /images folder is: "9ine-gaming.jpg"
I got no errors when installing the plugin and when I run dev on my project I get no errors but the image does not get converted. I have tried changing my image to src="images/9ine-gaming.jpg", I have also installed both dependences imagemin and imagemin-webp, that didn't change anything. I have also tried to change my webpack.config files to match your test-project, no luck either.
Here is my current config:
and here is my package: