datatypevoid / vulgar

A simple and scalable MEAN stack development kit featuring Angular 2 (Router, Http, Forms, Services, Tests, E2E, Coverage, Dev/Prod), Express, MongoDB, Mongoose, Node, PassportJS, Socket.io, Karma, Protractor, Jasmine, Istanbul, SASS Support, TypeScript, TSLint, NG2Lint, Hot Module Replacement, Docco, Gulp, and Webpack by @datatypevoid
MIT License
286 stars 66 forks source link

Problems building for production from fresh install #43

Open cepkoCC opened 7 years ago

cepkoCC commented 7 years ago

Starting from a pristine install, I had to make a couple of modifications before I was able to successfully build and serve for production.


First, I noticed that webpack-dev-server.js was being included in index.html regardless of NODE_ENV.

To fix this, I changed:

src/index.html L56 from <% if (webpackConfig.metadata.ENV === 'development') { %> to <% if (process.env.ENV === 'development') { %>


Next, I was having trouble getting my styles included with an EXCEPTION: Failed to load %5Bobject%20Object%5D error as seen in this SO question

For this, I changed:

src/app/app.component.ts L47 from styleUrls: [require('!style!css!sass!../sass/main.scss')], to styles: String[require('!style!css!sass!../sass/main.scss')],