Cannot read property 'contents' of undefined during build
See original GitHub issueUsing webpack v 4.29.6, my build fails at fontmin-webpack/lib/index.js:129, I get this error :
byExtension[item.extension].contents
TypeError: Cannot read property 'contents' of undefined
Here is some of my webpack config file : (I am also loading some .gif and .png files with file-loader, maybe it’s causing a conflict?)
module.exports = {
mode: 'production',
entry: entryObject,
module: {
rules: [
{
test: /(\.scss)$/,
use: [
{
loader: MiniCssExtractPlugin.loader
},
{
loader: "css-loader"
},
{
loader: "sass-loader",
options: {
implementation: require("node-sass")
}
},
{
loader: "postcss-loader",
}
]
},
{
test: /\.(woff(2)?|ttf|eot|svg|gif|png)(\?v=\d+\.\d+\.\d+)?$/,
use: [{
loader: 'file-loader',
options: {
name: '[name].[ext]',
outputPath: '../fonts/'
}
}]
},
]
},
plugins:
[
new MiniCssExtractPlugin({
filename: "../css/[name].css",
chunkFilename: "[id].css",
}),
new OptimizeCSSAssetsPlugin({}),
new FontminPlugin({
autodetect: true, // automatically pull unicode characters from CSS
}),
],
devtool: false,
}
}
Issue Analytics
- State:
- Created 4 years ago
- Comments:9 (5 by maintainers)
Top Results From Across the Web
Cannot Read Property of Undefined in JavaScript - Rollbar
TypeError: Cannot read property of undefined occurs when a property is read or a function is called on an undefined variable.
Read more >TypeError: Cannot read property 'content' of undefined
messageDelete has only one argument see the example so message variable is undefined and you are trying to read 'content' of "message".
Read more >Fatal error: Cannot read property 'contents' of undefined #208
I am trying to min all the images in a folder which has additional folders containing imgs inside of it. This issue only...
Read more >"Cannot read property '$$' of undefined" in build : r/sveltejs
I've figured the issue. It's that the target element did not exist when the Svelte app was mounted. There are two options to...
Read more >How To Fix Cannot read Property '0' of Undefined in JS
So why are you getting the TypeError mentioned above? You have most likely attempted to access your variable's contents while that variable has ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Have you given it a shot with v2.0.4? I published what should be a fix for this error message but didn’t have a bug repro so 🤷♂
Great!