Having some issues with babel and webpack. I'm not sure what introduced this issue, Its been intermittent, happened a few days ago then went away after hours of trying to debug. I'm not sure what fixed it then.
webpack.config --- relevant parts of package.json
The project is a multi-page jQuery and Flask app that is being moved to React. We are also using react-bootstrap
.
The issue is:
- When I make a change in a sass or css file
- After webpack compiles
- Babel can't find some of its helper functions. Either the paths cannot be resolved, or the wrong paths are being inserted.
- This only happens when webpack is running in watch mode. Restarting webpack will make the errors go away.
- The errors come back once I start watch mode again and make a change to any of my sass or css.
Some of the errors I've been getting on page load after compiling style changes:
1.
In console:Uncaught TypeError: dP.f is not a function
File in chrome inspector, _hide.js
var dP = require('./_object-dp');
var createDesc = require('./_property-desc');
module.exports = require('./_descriptors') ? function (object, key, value) {
return dP.f(object, key, createDesc(1, value));
} : function (object, key, value) {
object[key] = value;
return object;
};
// WEBPACK FOOTER
// ./node_modules/babel-polyfill/node_modules/core-js/modules/_hide.js
// module id = 136
// module chunks = 17
2.
Error in console: Uncaught TypeError: __WEBPACK_IMPORTED_MODULE_4_babel_runtime_helpers_inherits___default.a is not a function
File in chrome inspector, PanelGroup.js
- from react-bootstrap
relevant parts.
import _inherits from 'babel-runtime/helpers/inherits';
var PanelGroup = function (_React$Component) {
_inherits(PanelGroup, _React$Component);
3.
Error in console: __WEBPACK_IMPORTED_MODULE_3_babel_runtime_helpers_possibleConstructorReturn___default.a is not a function
File in chrome inspector, Collapse.js
- from react-bootstrap
relevant parts.
import _possibleConstructorReturn from 'babel-runtime/helpers/possibleConstructorReturn';
UPDATE:
rm -rf node_modules
does not help. Making any change to the JS entry file for the page will cause webpack to recompile and the error to go away.