ReferenceError: describe is not defined WHEN run npm run dev - javascript

Any something wrong with my package.json? The test is green when I run npm run test. But when I run npm run dev, the test is also run. There is no command config I write that it should run test when I run npm run dev
here is my package.json
"name": "domundotech-cashier",
"version": "0.0.0",
"private": true,
"scripts": {
"start": "node ./bin/www",
"dev": "set DEBUG=domundotech-cashier:* & nodemon --exec & npm start",
"test": "node ./node_modules/mocha/bin/mocha \"*/*.spec.js\""
},
"dependencies": {
"acorn": "^8.1.0",
"body-parser": "^1.19.0",
"cookie-parser": "~1.4.4",
"cors": "^2.8.5",
"debug": "~2.6.9",
"dotenv": "^8.2.0",
"eslint-plugin-jest": "^24.3.3",
"express": "~4.16.1",
"express-useragent": "^1.0.15",
"http-errors": "~1.6.3",
"install": "^0.13.0",
"jade": "~1.11.0",
"moment-timezone": "^0.5.33",
"morgan": "~1.9.1",
"mysql2": "^2.2.5",
"node-device-detector": "^1.3.4",
"npm": "^7.8.0",
"request": "^2.88.2",
"sequelize": "^6.6.2",
"typescript": "^4.2.3"
},
"devDependencies": {
"sequelize-test-helpers": "^1.3.2",
"proxyquire": "^2.1.3",
"mocha": "^8.3.2",
"chai": "^4.3.4",
"sinon": "^10.0.0",
"sinon-chai": "^3.6.0",
"supertest": "^6.1.3",
"#typescript-eslint/eslint-plugin": "^4.20.0",
"#typescript-eslint/parser": "^4.20.0",
"eslint": "^7.23.0",
"eslint-config-standard": "^16.0.2",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-promise": "^4.3.1",
"sequelize-cli": "^6.2.0"
}
}
and this for the error logs

Describe is defined in my test file. For now, I found the solution that I should ignore (-i) test files when executing nodemon :)
"start": "node ./bin/www",
"dev": "set DEBUG=domundotech-cashier:* & nodemon -i ./test & npm start",
"test": "mocha \"./test/*/*.spec.js\""
},
And I refactor my project structure too

Related

I am unable to debug in WebStorm npm configuration

I am running a Node app with an npm configuration in WebStorm but I cannot debug, I keep getting the error below.
I have a clean system with node 16.5.0 installed along with npm
The app runs or when you just run it.
"c:\Program Files\nodejs\npm.cmd" run start
Debugger listening on ws://127.0.0.1:63505/499bdffd-e2d2-40af-9e44-0fc1b93a7404
For help, see: https://nodejs.org/en/docs/inspector
Debugger attached.
Waiting for the debugger to disconnect...
^C^CTerminate batch job (Y/N)?
Process finished with exit code 1
Here is my package.json
{
"name": "storefront_backend",
"version": "0.1.0",
"description": "",
"main": "server.ts",
"scripts": {
"build": "tsc --build",
"start": "ts-node src/server.ts",
"watch": "tsc-watch --esModuleInterop src/server.ts --outDir ./dist --onSuccess \"node ./dist/server.js\"",
"test": "tsc -p . & mocha ./src/spec/*.js",
"tsc": "tsc"
},
"author": "Udacity",
"license": "ISC",
"dependencies": {
"body-parser": "^1.19.0",
"db-migrate": "^0.11.13",
"db-migrate-pg": "^1.2.2",
"dotenv": "^16.0.1",
"express": "^4.17.1",
"jsonwebtoken": "^8.5.1",
"pg": "^8.5.1",
"typescript": "^4.1.3"
},
"devDependencies": {
"#types/chai": "^4.3.1",
"#types/express": "^4.17.9",
"#types/jasmine": "^3.10.6",
"#types/mocha": "^9.1.1",
"#types/node": "^17.0.35",
"#types/pg": "^7.14.7",
"bcrypt": "^5.0.1",
"chai": "^4.3.6",
"chai-http": "^4.3.0",
"eslint": "^8.16.0",
"jasmine": "^3.6.4",
"jasmine-spec-reporter": "^6.0.0",
"jasmine-ts": "^0.3.0",
"jest": "^28.1.0",
"mocha": "^10.0.0",
"request": "^2.88.2",
"supertest": "^6.2.3",
"ts-node": "^9.1.1",
"tsc-watch": "^4.2.9"
}
}
Must be WEB-55884 that is fixed in 2022.1.2. Workaround: open Settings | Languages & Frameworks | Node.js and set Package manager to npm package folder, e.g. C:\Program Files\nodejs\node_modules\npm.

Nextjs fatal production only error after adding new package

We have a NextJs app that is running for couple of years in production.
Recently I added storybook-addon-pseudo-states addon ran the code locally and tested and pushed to production. The app was running perfectly locally. believe it or not after pushing to production, production entirely went down with this weird error.
{"statusCode":500,"code":"MODULE_NOT_FOUND","error":"Internal Server Error","message":"Cannot find module 'react-is'\nRequire stack:\n- /opt/webapp/node_modules/styled-components/dist/styled-components.cjs.js\n- /opt/webapp/.next/server/pages/_document.js\n- /opt/webapp/node_modules/next/dist/next-server/server/require.js\n- /opt/webapp/node_modules/next/dist/next-server/server/load-components.js\n- /opt/webapp/node_modules/next/dist/next-server/server/api-utils.js\n- /opt/webapp/node_modules/next/dist/next-server/server/next-server.js\n- /opt/webapp/node_modules/next/dist/server/next.js\n- /opt/webapp/server.js"}
This is our package.json.
{
"license": "UNLICENSED",
"private": true,
"scripts": {
"dev": "NODE_ENV=development yarn server-remove-types && yarn server-watch",
"build": "yarn server-remove-types && yarn server-compile && yarn server-copy && next build",
"server-remove-types": "flow-remove-types --all --pretty src/server --out-dir .untyped/server",
"server-compile": "ncc build .untyped/server/index.js --out .dist --minify --external next --external grpc",
"server-copy": "node ./util/copy.js --from .dist/index.js --to server.js",
"server-watch": "yarn server-watch-remove-types & yarn server-watch-compile & yarn server-watch-nodemon",
"server-watch-nodemon": "node .dist/index.js",
"server-watch-remove-types": "node util/watch-flow-remove-types.js --from src/server --to .untyped/server",
"server-watch-compile": "yarn server-compile --watch",
"lint-javascript": "eslint src",
"format": "eslint src --fix",
"type-install": "flow-typed install",
"type-upgrade": "flow-typed update",
"type-check": "flow check --color=always --show-all-errors",
"test-unit": "NODE_ENV=test jest --config ./config/jest.unit.config.js --colors",
"test-unit-watch": "yarn test-unit --watchAll --coverage false",
"test-unit-update-snapshots": "yarn test-unit --updateSnapshot",
"test-endpoints": "NODE_ENV=test jest --config ./config/jest.endpoints.config.js src/test/endpoints.spec.js",
"test-bdd": "echo 'Not implemented.'",
"test-contract": "echo 'Not implemented.'",
"test-e2e": "echo 'Not implemented.'",
"test-e2e-debug": "echo 'Not implemented.'",
"storybook": "start-storybook -p 3001",
"build-storybook": "build-storybook -o ./src/stories/storybook"
},
"engines": {
"node": ">=12"
},
"browserslist": [
"extends #dpgr/browserslist-config"
],
"dependencies": {
"#dpgr/browserslist-config": "^1.1.0",
"#dpgr/react-components": "^3.7.0",
"#sentry/browser": "6.10.0",
"#sentry/node": "6.10.0",
"#sentry/tracing": "6.10.0",
"#tippy.js/react": "^2.2.3",
"#vercel/ncc": "^0.31",
"axios": "0.18.1",
"babel-plugin-superjson-next": "^0.3.1",
"chart.js": "^2.9.4",
"chokidar": "^3.3.1",
"color": "^3.1.0",
"convert-array-to-csv": "^1.0.9",
"cookie": "^0.4.0",
"date-fns": "^2.4.1",
"dompurify": "^2.0.2",
"draft-js": "^0.11.0",
"draft-js-export-html": "^1.3.3",
"draft-js-import-html": "^1.3.3",
"fastify": "^2.0.0",
"fastify-cookie": "^3.0.2",
"flow-remove-types": "^2.115.0",
"focus-visible": "^5.0.0",
"formik": "^1.3.2",
"fs": "^0.0.1-security",
"google-protobuf": "^3.14.0",
"grpc": "^1.24.4",
"grpc-web": "^1.2.1",
"http-status-codes": "^1.3.0",
"iban": "^0.0.14",
"jsonwebtoken": "^8.5.1",
"lodash": "^4.17.11",
"minimist": "^1.2.0",
"mkdirp": "^0.5.1",
"next": "^10.0.0",
"next-cookies": "^2.0.3",
"next-redux-wrapper": "^7.0.0",
"node-xlsx": "^0.15.0",
"nodemon": "^2.0.2",
"nprogress": "^0.2.0",
"openid-client": "^3.13.0",
"p-queue": "^6.2.1",
"path-to-regexp": "^6.2.0",
"re-reselect": "^3.0.0",
"react": "^17.0.1",
"react-aria-modal": "^4.0.0",
"react-chartjs-2": "^2.11.1",
"react-copy-to-clipboard": "^5.0.1",
"react-datepicker": "^3.0",
"react-dom": "^17.0.1",
"react-paginate": "^6.3.0",
"react-redux": "^7.2.2",
"react-select": "^3.0.8",
"redux": "^4.0.0",
"redux-saga": "^1.1.1",
"regenerator-runtime": "^0.13.3",
"reselect": "^4.0.0",
"styled-components": "^5.0.0",
"styled-reboot": "^4.0.1",
"superjson": "^1.7.5",
"uuid": "^3.3.2",
"xlsx": "^0.17.1",
"yup": "^0.28.0"
},
"devDependencies": {
"#babel/core": "^7.13.15",
"#babel/eslint-parser": "^7.13.14",
"#babel/helper-builder-react-jsx": "^7.15.4",
"#babel/helper-builder-react-jsx-experimental": "^7.12.11",
"#babel/plugin-transform-flow-strip-types": "^7.4.4",
"#storybook/addon-actions": "6.3.12",
"#storybook/addon-controls": "^6.3.12",
"#storybook/addon-essentials": "6.3.12",
"#storybook/addon-links": "6.3.12",
"#storybook/react": "6.3.12",
"#testing-library/jest-dom": "^5.11.9",
"#testing-library/react": "12.0.0",
"#testing-library/react-hooks": "7.0.1",
"#wojtekmaj/enzyme-adapter-react-17": "^0.4.1",
"babel-loader": "^8.0.5",
"babel-plugin-inline-react-svg": "^1.1.1",
"babel-plugin-module-resolver": "^4.0",
"babel-plugin-styled-components": "^1.10.0",
"css-loader": "6.4.0",
"enzyme": "^3.11.0",
"enzyme-to-json": "^3.6.1",
"eslint": "^7.24.0",
"eslint-config-airbnb": "^18.0.1",
"eslint-import-resolver-babel-module": "^5.3.0",
"eslint-plugin-flowtype": "^4.3.0",
"eslint-plugin-import": "^2.14.0",
"eslint-plugin-jest": "^23.1.1",
"eslint-plugin-jsx-a11y": "^6.0.3",
"eslint-plugin-react": "^7.11.1",
"eslint-plugin-react-hooks": "^4.2",
"fastify-http-proxy": "^2.1.0",
"flow-bin": "^0.110.0",
"flow-typed": "^2.4.0",
"jest": "^26.6.3",
"jest-styled-components": "^7.0.5",
"mockdate": "^2.0.5",
"pretty": "^2.0.0",
"redux-devtools-extension": "^2.13.9",
"redux-mock-store": "^1.5.3",
"redux-saga-test-plan": "^4.0.1",
"redux-testkit": "^1.0.6",
"storybook-addon-designs": "6.2.0",
"storybook-addon-next-router": "3.0.8",
"style-loader": "3.3.0",
"supertest": "^6.1.6"
},
"peerDependencies": {}
}
These are the only changes made to package.json, plus few small changes in storybook stories.
Changes to package.json
Any idea what is the root cause for this fatal production only error?
The error says you're missing the library react-is and based on your package.json it doesn't appear to be installed.
The two scenarios that come to mind to explain erroring after package install / only in production.
Scenario 1
Someone could have manually deleted react-is from the package.json at some point in time after the last package manager sync and prior to your screenshot.
Package managers sync the changes in package.json when performing installs, updates, and uninstalls. Meaning, when you added the storybook plugin it removed the react-is package because it was no longer listed in the package.json file.
Scenario 2
Since it's only happening in production the app might not be using react-is but it is still included in a file.
import ReactIs from 'react-is'
Search your app for react-is - if it's not used, remove the unused statements - if it's used you need to install the package.

How long does it take to build an electron project?

I have a small project with few npm dependencies and it is taking more than 30 minutes (and counting) to build. I don't know if it is normal or there is something wrong that is delaying the build.
I have two questions:
Is it normal taking that long?
How long does an average project take to build?
My package.json:
{
"name": "...",
"version": "0.0.1",
"author": "Ricardo Villagrana <...#gmail.com>",
"description": "...",
"license": null,
"main": "./dist/electron/main.js",
"scripts": {
"build": "node .electron-vue/build.js && electron-builder",
"build:dir": "node .electron-vue/build.js && electron-builder --dir",
"build:clean": "cross-env BUILD_TARGET=clean node .electron-vue/build.js",
"build:web": "cross-env BUILD_TARGET=web node .electron-vue/build.js",
"dev": "node .electron-vue/dev-runner.js",
"e2e": "npm run pack && mocha test/e2e",
"lint": "eslint --ext .js,.vue -f ./node_modules/eslint-friendly-formatter src test",
"lint:fix": "eslint --ext .js,.vue -f ./node_modules/eslint-friendly-formatter --fix src test",
"pack": "npm run pack:main && npm run pack:renderer",
"pack:main": "cross-env NODE_ENV=production webpack --progress --colors --config .electron-vue/webpack.main.config.js",
"pack:renderer": "cross-env NODE_ENV=production webpack --progress --colors --config .electron-vue/webpack.renderer.config.js",
"test": "npm run unit && npm run e2e",
"unit": "karma start test/unit/karma.conf.js",
"postinstall": "npm run lint:fix && electron-builder install-app-deps",
"rebuild": "electron-rebuild -f -w sqlite3"
},
"build": {
"productName": "... - DektopApp",
"appId": "com.heroku.XXX",
"directories": {
"output": "build"
},
"files": [
"dist/electron/**/*"
],
"dmg": {
"contents": [
{
"x": 410,
"y": 150,
"type": "link",
"path": "/Applications"
},
{
"x": 130,
"y": 150,
"type": "file"
}
]
},
"mac": {
"icon": "build/icons/icon.icns"
},
"win": {
"icon": "build/icons/icon.ico"
},
"linux": {
"icon": "build/icons"
}
},
"dependencies": {
"#fortawesome/fontawesome-svg-core": "^1.2.8",
"#fortawesome/free-solid-svg-icons": "^5.5.0",
"#fortawesome/vue-fontawesome": "^0.1.2",
"axios": "^0.18.0",
"bcryptjs": "^2.4.3",
"bulma": "^0.7.2",
"electron-json-storage": "^4.1.4",
"font-awesome": "^4.7.0",
"sqlite3": "^4.0.3",
"vue": "^2.5.16",
"vue-electron": "^1.0.6",
"vue-router": "^3.0.1",
"vue-session": "^1.0.0",
"vuex": "^3.0.1",
"vuex-electron": "^1.0.0"
},
"devDependencies": {
"ajv": "^6.5.0",
"babel-core": "^6.26.3",
"babel-eslint": "^8.2.3",
"babel-loader": "^7.1.4",
"babel-plugin-istanbul": "^4.1.6",
"babel-plugin-transform-runtime": "^6.23.0",
"babel-preset-env": "^1.7.0",
"babel-preset-stage-0": "^6.24.1",
"babel-register": "^6.26.0",
"babili-webpack-plugin": "^0.1.2",
"cfonts": "^2.1.2",
"chai": "^4.1.2",
"chalk": "^2.4.1",
"copy-webpack-plugin": "^4.5.1",
"cross-env": "^5.1.6",
"css-loader": "^0.28.11",
"del": "^3.0.0",
"devtron": "^1.4.0",
"electron": "^2.0.4",
"electron-builder": "^20.19.2",
"electron-debug": "^1.5.0",
"electron-devtools-installer": "^2.2.4",
"electron-packager": "^12.2.0",
"electron-rebuild": "^1.8.2",
"electron-winstaller": "^2.7.0",
"eslint": "^4.19.1",
"eslint-config-standard": "^11.0.0",
"eslint-friendly-formatter": "^4.0.1",
"eslint-loader": "^2.0.0",
"eslint-plugin-html": "^4.0.3",
"eslint-plugin-import": "^2.12.0",
"eslint-plugin-node": "^6.0.1",
"eslint-plugin-promise": "^3.8.0",
"eslint-plugin-standard": "^3.1.0",
"file-loader": "^1.1.11",
"html-webpack-plugin": "^3.2.0",
"inject-loader": "^4.0.1",
"karma": "^2.0.2",
"karma-chai": "^0.1.0",
"karma-coverage": "^1.1.2",
"karma-electron": "^6.0.0",
"karma-mocha": "^1.3.0",
"karma-sourcemap-loader": "^0.3.7",
"karma-spec-reporter": "^0.0.32",
"karma-webpack": "^3.0.0",
"mini-css-extract-plugin": "0.4.0",
"mocha": "^5.2.0",
"multispinner": "^0.2.1",
"node-loader": "^0.6.0",
"node-sass": "^4.9.2",
"postcss-loader": "^3.0.0",
"require-dir": "^1.0.0",
"sass-loader": "^7.0.3",
"spectron": "^3.8.0",
"style-loader": "^0.21.0",
"tailwindcss": "^0.7.2",
"url-loader": "^1.0.1",
"vue-html-loader": "^1.2.4",
"vue-loader": "^15.2.4",
"vue-style-loader": "^4.1.0",
"vue-template-compiler": "^2.5.16",
"webpack": "^4.15.1",
"webpack-cli": "^3.0.8",
"webpack-dev-server": "^3.1.4",
"webpack-hot-middleware": "^2.22.2",
"webpack-merge": "^4.1.3"
}
}
It depends upon a lot of factors including your hardware and size of project. But in general, for medium size projects, is should not take that long.
It is usually wrapped up in a few minutes, say 3-4 minutes on decent hardware.
A few observations:
As per your dependency tree, it doesn't look like you have any heavy dependencies. So assuming you're on a decent hardware it should not take that long.
Also, looks like you're using webpack, make sure you've set your project directory correctly, and it does not includes your node_modules folder. Because if it does, large build times can be explained due to webpack bundling your entire node_modules dir instead of the usual src dir.
If it's a typescript project, make sure to add exclude key in your tsconfig.json file for all (if any) pre-compiled library that you're using outside of your node modules dir. This has personally happened to me before, and it does increases your build time rather significantly.

Non deterministic behavior on dependencies - nodejs

I would solve a warning: when I run yarn install all dependencies are installed but I receive this warning:
warning Pattern ["esprima-fb#~3001.0001.0000-dev-harmony-fb"] is
trying to unpack in the same destination
"/Users/Me/Library/Caches/Yarn/v1/npm-esprima-fb-3001.1.0-dev-harmony-fb-b77d37abcd38ea0b77426bb8bc2922ce6b426411"
as pattern ["esprima-fb#~3001.1.0-dev-harmony-fb"]. This could result
in a non deterministic behavior, skipping.
If I delete node_modules folder and I run yarn install I don't receive the warning, when I re-execute yarn install I receive it again.
I suppose the problem is in yarn-lock file.
package.json
{
"name": "n1",
"version": "1.0.0",
"description": "none ",
"author": "none",
"main": "src/index.js",
"private": false,
"engines": {
"node": ">=7.6",
"yarn": "*"
},
"scripts": {
"precommit": "yarn lint",
"prestart": "yarn docs",
"start": "cross-env NODE_ENV=production pm2 start ./src/index.js",
"dev": "nodemon ./src/index.js",
"lint": "eslint **/*.js --ignore-path .gitignore --ignore-pattern internals/scripts",
"lint:fix": "yarn lint -- --fix",
"lint:watch": "yarn lint -- --watch",
"test": "cross-env NODE_ENV=test nyc --reporter=html --reporter=text mocha --timeout 20000 --recursive src/api/tests",
"test:unit": "cross-env NODE_ENV=test mocha src/api/tests/unit",
"test:integration": "cross-env NODE_ENV=test mocha --timeout 20000 src/api/tests/integration",
"test:watch": "cross-env NODE_ENV=test mocha --watch src/api/tests/unit",
"coverage": "nyc report --reporter=text-lcov | coveralls",
"postcoverage": "opn coverage/lcov-report/index.html",
"validate": "yarn lint && yarn test",
"postpublish": "git push --tags",
"docs": "apidoc -i src -o docs",
"postdocs": "opn docs/index.html"
},
"dependencies": {
"bcryptjs": "^2.4.3",
"blubird": "^0.0.1-security",
"bluebird": "^3.5.1",
"body-parser": "^1.18.2",
"chalk": "^2.3.0",
"color": "^2.0.1",
"compression": "^1.7.1",
"cookie-parser": "^1.4.3",
"cors": "^2.8.4",
"cross-env": "^5.1.3",
"dotenv-safe": "^4.0.4",
"espree": "^3.5.2",
"esprima": "^4.0.0",
"express": "^4.16.2",
"express-validation": "^1.0.2",
"express-winston": "^2.4.0",
"helmet": "^3.9.0",
"http-status": "^1.0.1",
"joi": "^10.6.0",
"jwt-simple": "^0.5.1",
"lodash": "^4.17.4",
"method-override": "^2.3.10",
"moment": "^2.20.1",
"moment-timezone": "^0.5.14",
"mongoose": "^4.13.7",
"morgan": "^1.9.0",
"morgan-body": "^2.0.2",
"mysql": "^2.15.0",
"mysql2": "^1.5.1",
"nedb": "^1.8.0",
"node-geocoder": "^3.21.1",
"only": "0.0.2",
"passport": "^0.4.0",
"passport-jwt": "^3.0.1",
"pm2": "^2.9.1",
"readline-sync": "^1.4.7",
"request-promise": "^4.2.2",
"sequelize": "^4.28.6",
"serve-favicon": "^2.4.5",
"winston": "^2.4.0",
"yarn": "^1.3.2"
},
"devDependencies": {
"apidoc": "^0.17.5",
"chai": "^4.1.2",
"chai-as-promised": "^7.1.1",
"coveralls": "^2.13.1",
"eslint": "^4.13.1",
"eslint-config-airbnb-base": "^12.1.0",
"eslint-plugin-import": "^2.8.0",
"husky": "^0.14.3",
"mocha": "^3.5.3",
"nodemon": "^1.14.1",
"nyc": "^11.4.1",
"opn-cli": "^3.1.0",
"sinon": "^3.3.0",
"sinon-chai": "^2.14.0",
"supertest": "^3.0.0"
},
"license": "MIT"
}
yarn-lock
https://pastebin.com/vTrLHWff
Try removing both node_modules and yarn.lock:
rm -rf node_modules and rm yarn.lock
And then try running:
npm run rebuild which seem to help to resolve the issue.

Module build failed: ReferenceError: [BABEL] Unknown option: base.stage

I upgraded my react/webpack app using ncu and it updated babelify to 7.2.0 (and hence babel to 6.0.0). Now I am getting the following error:
ERROR in ./app/main.js
Module build failed: ReferenceError: [BABEL] /home/ben/simple-webpack-react-starter/app/main.js: Unknown option: base.stage
Ive looked through a bunch of stack overflow posts with the same or similar errors and have done everything suggested. I'm pretty stuck! Please help. Here are the relevant files i think:
My package.json file:
{
"name": "MODA",
"version": "1.0.0",
"description": "Online Annotations",
"main": "server/index.js",
"scripts": {
"dev-server": "nodemon server/index.js --watch server",
"dev-web": "webpack-dev-server --config ./webpack-dev.config.js --hot --progress --colors --content-base build",
"dev": "nodemon server/index.js --watch server & webpack-dev-server --config ./webpack-dev.config.js --hot --progress --colors --content-base build",
"build": "rm build/*; webpack --config ./webpack-prod.config.js --progress --colors",
"start": "node server/index.js",
"test": "karma start",
"testing": "karma start --single-run=false"
},
"license": "MIT",
"dependencies": {
"compression": "^1.5.0",
"cors": "^2.7.1",
"express": "^4.13.3",
"body-parser": "*",
"ejs": "*",
"aws-sdk": "*"
},
"engines": {
"node": "5.0.0",
"npm": "2.14.9"
},
"devDependencies": {
"autoprefixer-loader": "^3.2.0",
"babel-core": "^6.2.1",
"babel-loader": "^6.2.0",
"babel-preset-es2015": "^6.1.18",
"babel-preset-react": "^6.3.13",
"babel-preset-stage-0": "^6.0.15",
"babelify": "^7.2.0",
"bootstrap": "^3.3.5",
"css-loader": "^0.23.1",
"expect": "^1.6.0",
"file-loader": "^0.8.4",
"html-webpack-plugin": "^2.8.1",
"image-webpack-loader": "^1.6.1",
"jquery": "^2.1.4",
"json-fs": "^1.1.1",
"karma": "^0.13.19",
"karma-chrome-launcher": "^0.2.2",
"karma-cli": "0.1.2",
"karma-mocha": "^0.2.1",
"karma-sinon": "^1.0.4",
"karma-sourcemap-loader": "^0.3.5",
"karma-webpack": "^1.5.1",
"mocha": "^2.2.5",
"node-libs-browser": "^1.0.0",
"node-sass": "^3.2.0",
"nodemon": "^1.3.7",
"react": "^0.14.7",
"react-dom": "^0.14.7",
"react-draggable": "^1.1.3",
"react-hot-loader": "^1.2.7",
"react-resizable-box": "^0.1.7",
"sass-loader": "^3.1.2",
"sinon": "^1.15.3",
"style-loader": "^0.13.0",
"webpack": "^1.9.11",
"webpack-dev-server": "^1.9.0"
}
}
And the relevant part of my webpack-common.config
{
test: /\.jsx?$/,
exclude: /(node_modules | bower_components)/,
loader: "babel",
query: {
presets:['es2015','stage-0', "react"]
},
},
I had this problem and I fixed it by eliminating the query in the config file and instead making a .babelrc file at project root like so:
{
"passPerPreset": true,
"presets": [
{
"plugins": [
"./build/babelRelayPlugin"
]
},
"react",
"es2015",
"stage-0"
]
}

Categories