create-graphql-server icon indicating copy to clipboard operation
create-graphql-server copied to clipboard

Add production build command

Open lorensr opened this issue 7 years ago • 1 comments

npm run build since babel-node isn't meant for production use. My attempt is failing:

$ GLOBIGNORE="node_modules/*"; babel **/*.js -o build.js 
ReferenceError: [BABEL] data/chapters.js: Unknown option: /Users/me/gh/api-model/node_modules/babel-preset-env/lib/index.js.__esModule. Check out http://babeljs.io/docs/usage/options/ for more info
    at Logger.error (/usr/local/lib/node_modules/babel-cli/node_modules/babel-core/lib/transformation/file/logger.js:39:11)
    at OptionManager.mergeOptions (/usr/local/lib/node_modules/babel-cli/node_modules/babel-core/lib/transformation/file/options/option-manager.js:267:20)
    at /usr/local/lib/node_modules/babel-cli/node_modules/babel-core/lib/transformation/file/options/option-manager.js:349:14
    at /usr/local/lib/node_modules/babel-cli/node_modules/babel-core/lib/transformation/file/options/option-manager.js:369:24
    at Array.map (native)
    at OptionManager.resolvePresets (/usr/local/lib/node_modules/babel-cli/node_modules/babel-core/lib/transformation/file/options/option-manager.js:364:20)
    at OptionManager.mergePresets (/usr/local/lib/node_modules/babel-cli/node_modules/babel-core/lib/transformation/file/options/option-manager.js:348:10)
    at OptionManager.mergeOptions (/usr/local/lib/node_modules/babel-cli/node_modules/babel-core/lib/transformation/file/options/option-manager.js:307:14)
    at OptionManager.addConfig (/usr/local/lib/node_modules/babel-cli/node_modules/babel-core/lib/transformation/file/options/option-manager.js:207:10)
    at OptionManager.findConfigs (/usr/local/lib/node_modules/babel-cli/node_modules/babel-core/lib/transformation/file/options/option-manager.js:413:16)
"dev": "babel-node index.js",
"build": "rm build.js; babel -d/o something",
"start": "node build.js"

lorensr avatar Dec 22 '17 08:12 lorensr

We use this:

  "scripts": {
    "dev": "PORT=3007 DEBUG=index* babel-node index.js",
    "start": "node dist/server/index.js",
    "prebuild": "rm -rf ./dist",
    "build": "babel . -d dist --copy-files"
  }

tmeasday avatar Dec 28 '17 00:12 tmeasday