gatsby: [1.0] Typeface produces error in production build
I’m importing a typeface package in my default layout. It works in development. In production the font also loads, but produces the following error.
bootstrap b3d99bd…:52 Uncaught TypeError: Cannot read property 'call' of undefined
at t (bootstrap b3d99bd…:52)
at Object../node_modules/typeface-roboto/index.css (index.css:1)
at t (bootstrap b3d99bd…:52)
at Object../node_modules/babel-loader/lib/index.js?{"presets":["/Users/me/project/node_modules/babel-preset-env/lib/index.js","/Users/me/project/node_modules/babel-preset-react/lib/index.js","/Users/me/project/node_modules/babel-preset-stage-1/lib/index.js","/Users/me/project/node_modules/babel-preset-es2015/lib/index.js","/Users/me/project/node_modules/babel-preset-stage-0/lib/index.js","/Users/me/project/node_modules/babel-preset-react/lib/index.js"],"env":{"development":{"plugins":["add-module-exports","flow-react-proptypes",["styled-components",{"minify":false,"displayName":true}]]},"production":{"plugins":["add-module-exports","flow-react-proptypes",["styled-components",{"ssr":true,"displayName":false}]]}},"plugins":["/Users/me/project/node_modules/gatsby/dist/utils/babel-plugin-extract-graphql.js","/Users/me/project/node_modules/babel-plugin-add-module-exports/lib/index.js","/Users/me/project/node_modules/babel-plugin-add-module-exports/lib/index.js","/Users/me/project/node_modules/babel-plugin-transform-object-assign/lib/index.js"],"cacheDirectory":true}!./src/layouts/index.js (index.js:10)
at t (bootstrap b3d99bd…:52)
at index.js?9a34:3
at window.webpackJsonp (bootstrap b3d99bd…:20)
at layout-component---index-b4f03b0….js:1
It points to this line in bootstrap
// Execute the module function
modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
And further down
exports = module.exports = require("../css-loader/lib/css-base.js")();
in index.css
I didn’t change anything to the webpack configuration regarding css. Any idea what might cause this?
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 6
- Comments: 25 (11 by maintainers)
Today I have encountered the same issue and can not get it to work.
Do you guys have any updates on this?
I ran into this, and the root problem was that I was caching JS files, which Gatsby v1 doesn’t support. See #2538 and docs on caching.
The problem’s fixed since we made sure our CDN doesn’t cache JS.
What was the resolution to this problem? We’re also having this problem – not related to Bootstrap tho. Seems like the webpackJsonp referencing the wrong hashed js file.
I had the error on 1.9.158 and I just updated to 1.9.199 and I still have the error.
I just briefly ran into this problem again, and it had to do with caching for me too. I was doing a local test of a prod build and using
serve -s public/
which enables caching. Serving withserve public/
and doing a hard refresh fixed the problemI’m running into this issue now here:
https://jason.stallin.gs
It happens occasionally when you navigate between pages. I can’t reliably reproduce it, but when it happens the navigation fails. Then sometimes you can click the link again and it will work, sometimes you have to refresh the page.
The source code is here, trying to debug it and figure it out: https://github.com/octalmage/jason.stallin.gs