-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Production? #20
Comments
Hey @stokesbga, were you ever able to find a solution? |
@abecks Don't use I've started using a yarn-workspaces (lerna is another good option if you're using npm) monorepo with my modified version of sails, sails-hook-orm, and sails-disk in it that allows me to use babel properly. You can also do or to install directly from my repos (I recommend the monorepo approach though, so you can maintainthem yourself). This is similar to what the structure of my sails project now looks like: .
├── .babelrc
├── .env
├── .eslintignore
├── .eslintrc
├── .sailsrc
├── assets
├── package.json
├── src
│ ├── api
│ ├── app.js
│ ├── config
│ └── views
└── test How my project looks like as a monorepo with sails and my project in it: .
├── package.json
├── packages
│ ├── my-sails-project
│ ├── sails
│ ├── sails-disk
│ └── sails-hook-orm
└── yarn.lock You'll need to add these scripts in your {
"scripts": {
"build": "babel src --out-dir dist --source-maps --copy-files",
"dev": "node -r babel-register src/app.js",
"start": "node dist/app.js"
}
} To start your project in development, you'd run devDependencies you'll need: My import 'dotenv/config';
import path from 'path';
import rc from 'sails/accessible/rc';
import sails from 'sails';
const config = rc('sails');
config.appPath = __dirname;
config.paths = Object.assign(config.paths || {}, {
public: path.join(__dirname, '..', 'assets'),
});
sails.lift(config); I'm using I submitted these changes in a PR to sails a while ago, but seems it was missed. |
Yep, pretty much what I was going to say. Use babel-cli to generate a build folder and deploy that. I have a package script that creates build folder, ignores some shit I only use in dev, then deploys that to production branch in git. Production branch has a hook that deploys.
Clean just empties the build dir and pulls latest from prod branch Let me/us know how it goes. |
Does anyone have an elegant solution for building a sails app with babel for production?
The text was updated successfully, but these errors were encountered: