Encountered this error before and seen other answers but the solution does not solve my problem.
in my package.json I have:
"dependencies": { "axios": "^0.15.2", "babel": "^6.5.2", "babel-core": "^6.13.1", "babel-loader": "^6.0.1", "babel-preset-es2015": "^6.0.15", "babel-preset-node5": "^11.1.0", "babel-preset-react": "^6.0.15", "babel-preset-stage-0": "^6.0.15", "babel-preset-stage-2": "^6.11.0", then in my webpack.config.js I have:
module.exports = { entry: './main.js', then in my main.js I have:
import "./src"; I then run npm test which calls this script:
"scripts": { "test": "mocha src/**/*.spec.js", and then it fails because inside src/components/header/index.spec.js:1 I have: import React from 'react';
cant work out why it wont work
I have a .babelrc file with this in:
{ "sourceMaps": true, "presets": ["es2015", "react", "stage-2"] } also in my webpack I have:
module: { loaders: [ { test: /\.js$/, exclude: /node_modules/, loader: 'babel', query: { presets: ['es2015', 'react', 'stage-2'] } }, { test: /\.scss$/, loaders: ["style-loader", "css-loader", "sass-loader"] } ] } any ideas?