question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Module not found: Error: Can't resolve 'core-js/modules/es6.object.create'

See original GitHub issue

Having issues trying to build server side react node js application.

ERROR in ./src/external/BaseComponent.js
Module not found: Error: Can't resolve 'core-js/modules/es6.object.create' in 'C:\Users\Too\WebstormProjects\react_back\src\external'
 @ ./src/external/BaseComponent.js 4:0-43
 @ ./src/server.js
 @ ./src/index.js

Seemed like its something about core-js version. It generates polyfill requires like this:

require("core-js/modules/es6.symbol");

But actually they are so:

core-js/modules/es.symbol.js

npm ls core-js

react_back@1.0.0 C:\Users\Too\WebstormProjects\react_back
+-- @babel/preset-env@7.4.2
| -- core-js-compat@3.0.0
|   -- core-js@3.0.0  deduped
-- core-js@3.0.0

Webpack config

const path = require('path');
module.exports = {
    entry: './src/index.js',
    mode: 'development',
    output: {
        path: path.resolve(__dirname, 'assets'),
        filename: "[name].js"
    },
    module: {
        rules: [
            {
                test: /\.js$/,
                exclude: /node_modules/,
                loader: "babel-loader"
            }
        ]
    },
    target: 'node',
    node: {
        console: true
    },
    externals: ['express'],
};

package.json

{
  "name": "react_back",
  "version": "1.0.0",
  "description": "",
  "main": "src/index.js",
  "keywords": [],
  "author": "",
  "license": "ISC",
  "scripts": {
    "start": "node src/index.js",
    "pack": "webpack --config webpack.config.babel.js",
    "babel": "babel src -d views",
    "build": "npm run pack && npm run babel"
  },
  "dependencies": {
    "core-js": "^3.0.0",
    "express": "^4.16.3",
    "react": "^16.8.6",
    "react-dom": "^16.8.6",
    "react-redux": "^5.0.7",
    "redux": "^3.7.2",
    "redux-thunk": "^2.3.0"
  },
  "devDependencies": {
    "@babel/cli": "^7.1.0",
    "@babel/core": "^7.1.0",
    "@babel/preset-env": "^7.1.0",
    "@babel/preset-react": "^7.0.0",
    "babel-loader": "^8.0.2",
    "webpack": "^4.20.2",
    "webpack-cli": "^3.1.2"
  }
}

.babelrc

{
  "presets": [
    ["@babel/preset-env", {
      "useBuiltIns": "usage",
      "debug": true
    }],
    "@babel/preset-react"
  ]
}

Any ideas?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:3
  • Comments:13 (5 by maintainers)

github_iconTop GitHub Comments

3reactions
nicolo-ribaudocommented, Mar 30, 2019

By default Babel injects imports to core-js@2, you need to install that. Or better, you can update preset-env to ^7.4.0 and enable the corejs: 3 option of that preset.

1reaction
milesjcommented, Apr 2, 2019
Read more comments on GitHub >

github_iconTop Results From Across the Web

Module not found: Error: Can't resolve 'core-js/es6'
To resolve this error, you can downgrade the core-js version to 2.5.7. This version produces correct catalogs structure, with separate ES6 ...
Read more >
Module not found: Error: Can't resolve 'core-js/es6' - SyntaxFix
I've got a problem with my build process in relation to my React app. I always get the following error: Module not found:...
Read more >
Module not found: Error: Can't resolve 'core-js/client/shim'
solution install core-js@2.6.5. ... Module not found: Error: Can't resolve 'core-js/modules/es6.object.create. Comment. 1. Tip Restu Wahyu Saputra 1 GREPCC.
Read more >
Module not found: Error: Can't resolve 'core-js/client/shim'
solution install core-js@2.6.5.
Read more >
fable-compiler/Fable - Gitter
All in this module are JS functions? ... For example: Module not found: Error: Can't resolve ... Can't resolve 'core-js/modules/es6.object.to-string. Error: ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found