Chris Chong
Chris Chong

Reputation: 371

Baqend boilerplate fails to npm run build

I'm testing out the Baqend boilerplate downloaded from https://www.baqend.com/guide/starter-kits/react/ and when do npm run build, it throws this error:

Creating an optimized production build...
Failed to compile.

Failed to minify the code from this file: 

    ./node_modules/baqend/lib/util/Metadata.js:12 

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] build: `react-scripts build`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

Hopefully I'm just using an older version of the SDK?

This works great on localhost!

The package file:

{
  "name": "Nurse Uber Web",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "baqend": "^2.8.6",
    "lodash": "^4.17.4",
    "prop-types": "^15.5.9",
    "react": "^15.6.1",
    "react-bootstrap": "^0.31.3",
    "react-dom": "^15.6.1",
    "react-redux": "^5.0.6",
    "react-router": "^4.1.2",
    "react-router-dom": "^4.1.2",
    "redux": "^3.7.2",
    "redux-baqend": "^1.0.4",
    "redux-logger": "^3.0.6",
    "redux-thunk": "^2.2.0"
  },
  "devDependencies": {
    "react-scripts": "^1.0.11"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test --env=jsdom"
  }
}

Upvotes: 0

Views: 205

Answers (1)

KddC
KddC

Reputation: 3033

according to this link it's considered bad practice to import a libraries sources directly. You can avoid this problem by simply importing the compiled version. Just change import { db } from 'baqend/lib/baqend' to import { db } from 'baqend' in all your application sources (store.js and Messages.js in the starter) and it should work. Thank you for pointing this out.

Upvotes: 2

Related Questions