I’ve moved everything over from a working project (ultimate-hot-reloading-example), to an existing project of mine that uses the keystone cms. I uninstalled ALL dev dependencies in my project, and installed all of the exact dependencies in the working project into mine (webpack, babel, etc…).
For some reason, the web.config.js file won’t parse the es6 syntax
export default
Which gives this error:
- configuration has an unknown property 'default'.
If I switch to the following, it works:
const config = ... module.exports = config;
Elsewhere in my project, I use other es6 syntax and it works…
Here’s the dependencies in package.json, which works perfectly with the example project with the ‘export default’ syntax.
"dependencies": { "babel-cli": "^6.10.1", "babel-core": "^6.10.4", "babel-eslint": "^8.2.3", "babel-loader": "^7.1.1", "babel-plugin-react-transform": "^3.0.0", "babel-plugin-transform-runtime": "^6.9.0", "babel-preset-env": "^1.7.0", "babel-preset-react": "^6.11.1", "babel-register": "^6.9.0", "babel-runtime": "^6.9.2", "chokidar": "^2.0.3", "css-loader": "^0.28.11", "css-modules-require-hook": "^4.0.1", "eslint": "^4.19.1", "eslint-plugin-react": "^7.8.1", "express": "^4.14.0", "prop-types": "^15.6.1", "react": "^16.3.2", "react-dom": "^16.3.2", "react-hot-loader": "^4.1.3", "react-redux": "^5.0.7", "redux": "^4.0.0", "style-loader": "^0.21.0", "webpack": "^4.8.3", "webpack-dev-middleware": "^3.1.3", "webpack-hot-middleware": "^2.12.1", "webpack-node-externals": "^1.7.2"
Any idea why this would happen?
Advertisement
Answer
I had a similar problem which turned to be my improper migration from require(...)
to import(...)
I replaced this code:
const common = require("./webpack.common"); module.exports = merge(common, {...})
with:
const common = await import("./webpack.common.js"); export default merge(common, .....)
The problem was that I didn’t use the default
export from webpack.common.js
. The fix is:
const common = await import("./webpack.common.js"); export default merge(common.default, .....)